#include "operationwindow.h"
#include "ui_operationwindow.h"
#include<QStringList>
#include<QDebug>
#include<QMessageBox>
#include<QTimer>
#include<QTime>
#include<QApplication>
#include<QEventLoop>
#include"qwtplot.h"
#include<qwt_plot_marker.h>
operationWindow::operationWindow(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::operationWindow)
{
    ui->setupUi(this);
    ui->qwtPlot->hide();//先隐藏绘图    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);//设置表格不可编辑
    this->setWindowTitle("仪器操作界面");
    ui->tableWidget->horizontalHeader()->setVisible(false);//隐藏列表头
    ui->tableWidget->verticalHeader()->setVisible(false);//隐藏行表头
    ui->tableWidget->setShowGrid(false);//隐藏分割线
    arrangement<<"1.α排列(温纳装置AMNB)"
              <<"2.β排列(偶极装置ABMN)"
             <<"3.γ排列(微分装置AMBN)";
//    qDebug()<<arrangement[0];
    measureInputString[0] = "断面号：1";
    measureInputString[1] = "实接电极数：__";
    measureInputString[2] = "输入电极号：__";
    measureInputString[3] = "输入滚动号：__";
    measureInputString[4] = "确认─执行操作";
    measureInputString[5] = "退出─取消操作";
    points1<<QPointF(1,223.87)<<QPointF(2,223.15)<<QPointF(3,220.47)
          <<QPointF(4,264.29)<<QPointF(5,281.89)<<QPointF(6,249.17)<<QPointF(7,252.14)
         <<QPointF(8,228.21)<<QPointF(9,240.28)<<QPointF(10,197.84)<<QPointF(11,241.90)
        <<QPointF(12,181.52)<<QPointF(13,222.43)<<QPointF(14,226.71)<<QPointF(15,189.69)
       <<QPointF(16,245.19)<<QPointF(17,235.98)<<QPointF(18,248.98)<<QPointF(19,270.83)<<QPointF(20,316.51);
    pointTemp = points1;

    point0<<QPointF(1,1723.87)<<QPointF(2,1723.15)<<QPointF(3,1720.47)
            <<QPointF(4,1764.29)<<QPointF(5,1781.89)<<QPointF(6,1749.17)
           <<QPointF(7,1752.14)<<QPointF(8,1728.21)<<QPointF(9,1740.28)
          <<QPointF(10,1697.84)<<QPointF(11,1741.90)<<QPointF(12,1681.52)
         <<QPointF(13,1681.52)<<QPointF(14,1726.71)<<QPointF(15,1726.71)
        <<QPointF(16,1745.19)<<QPointF(17,1735.98)<<QPointF(18,1770.83)
       <<QPointF(19,1770.83)<<QPointF(20,1816.51);
    point1<<QPointF(2,1516.09)<<QPointF(3,1595.43)<<QPointF(4,1583.53)
           <<QPointF(5,1552.32)<<QPointF(6,1534.59)<<QPointF(7,1511.66)
          <<QPointF(8,1475.80)<<QPointF(9,1520.93)<<QPointF(10,1463.27)
         <<QPointF(11,1448.29)<<QPointF(12,1460.19)<<QPointF(13,1416.69)
        <<QPointF(14,1454.46)<<QPointF(15,1403.09)<<QPointF(16,1383.60)
       <<QPointF(17,1406.77)<<QPointF(18,1424.36)<<QPointF(19,1415.70);
    point2<<QPointF(3,1212.49)<<QPointF(4,1197.46)<<QPointF(5,1162.21)
           <<QPointF(6,1202.87)<<QPointF(7,1185.27)<<QPointF(8,1212.18)
          <<QPointF(9,1171.56)<<QPointF(10,1202.38)<<QPointF(11,1201.00)
         <<QPointF(12,1211.24)<<QPointF(13,1223.50)<<QPointF(14,1205.02)
        <<QPointF(15,1188.34)<<QPointF(16,1177.92)<<QPointF(17,1175.01)
       <<QPointF(18,1171.63);
    point3<<QPointF(4,932.56)<<QPointF(5,911.89)<<QPointF(6,967.68)
           <<QPointF(7,965.57)<<QPointF(8,930.07)<<QPointF(9,966.02)
          <<QPointF(10,962.58)<<QPointF(11,940.14)<<QPointF(12,946.64)
         <<QPointF(13,969.48)<<QPointF(14,957.36)<<QPointF(15,947.02)
        <<QPointF(16,943.20)<<QPointF(17,971.15);
    point4<<QPointF(5,744.62)<<QPointF(6,725.66)<<QPointF(7,719.36)
          <<QPointF(8,729.80)<<QPointF(9,728.35)<<QPointF(10,763.65)
         <<QPointF(11,798.73)<<QPointF(12,781.69)<<QPointF(13,774.18)
        <<QPointF(14,793.30)<<QPointF(15,821.62)<<QPointF(16,793.66);
    point5<<QPointF(6,522.48)<<QPointF(7,480.26)<<QPointF(8,498.82)
           <<QPointF(9,480.56)<<QPointF(10,450.53)<<QPointF(11,432.22)
          <<QPointF(12,433.99)<<QPointF(13,441.89)<<QPointF(14,425.16)
         <<QPointF(15,393.21);
    point6<<QPointF(7,156.10)<<QPointF(8,176.06)<<QPointF(9,178.20)
           <<QPointF(10,195.96)<<QPointF(11,219.53)<<QPointF(12,178.94)
          <<QPointF(13,173.83)<<QPointF(14,220.36);
    //点击返回按钮
    connect(ui->btnBack,&QPushButton::clicked,[=](){
        this->hide();
        emit toMainWindow();//功能键被点击
    });

    //点击按钮“开”
    connect(ui->btnOpen,&QPushButton::clicked,[=](){
        if(state[0] == 1)
        {
            emit Open();
            state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
            state[4] = 0;state[5] = 1;state[6] = 0;state[7] = 0;
            state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
            state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 0;
            state[16] = 0;state[17] = 0;

//            state[13] = 1;//退出键
//            state[5] = 1;//功能键
        }
    });
    //按钮关
    connect(ui->btnClose,&QPushButton::clicked,[=](){
        if(state[1] == 1)
        {
            ui->tableWidget->clear();
            state[0] = 1;state[1] = 0;state[2] = 0;state[3] = 0;
            state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
            state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
            state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
            state[16] = 0;state[17] = 0;

            countInputNumber = 1;
            timerStop = 1;
            timerStop2 = 1;
            timerStopMeasure = 1;
            timerStopMeasure2 = 1;

            arrayCount = 0;
            dotPitch = 0.;//存储点距
            arrayStop = 0;//判断是否停止闪烁
            arrayTimer = 1;
            countArrayInputNumber = 1;//判断输入了几个数字,最多为两个
            highDensity = 0;//判断选择的是否为高密度测量方式
            sleepStop = 0;//高密度方式-供电时间-判断是否停止闪烁
            highDensityCount = 1;//计数
            highDensityDataAll = 5;//存储供电时间,默认为5

            count = 0;
            countIn = 0;
            loop = true;
            timerStop = 0;//设置参数界面-闪烁，判断定时器停止
            timerStop2 = 0;
            timerStopMeasure = 0;//输入测量参数，设置参数界面-闪烁，判断定时器停止
            timerStopMeasure2 = 0;
            countInputNumber = 1;//判断输入了几个数字
            countInputNumberMeasure = 1;//测量-判断输入了几个数字
            saveData = 0;//保存结果
            saveDataMeasure = 0;//保存结果-起始剖面号
            saveDataMeasure2 = 0;//保存结果-结束剖面号
            measureStop = 0;//测量界面-输入三个参数-判断是否停止闪烁
            measureTimer = 1;//循环用，实现闪烁
            countMeasureInput = 1;//判断测量参数输入了几个数

            ui->qwtPlot->hide();
            plot->hide();
        }
    });

    //点击按钮“功能”选择功能
    connect(ui->btnSave,&QPushButton::clicked,[=](){
        if(state[5] == 1)
        {
            emit functionMenu();
            nBtnNumber2 = 1;
            state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
            state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 0;
            state[8] = 0;state[9] = 0;state[10] = 1;state[11] = 1;
            state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
            state[16] = 0;state[17] = 0;
            nBtnNumber1 = 4;
            nBtnNumber2 = 1;
            nBtnNumber3 = 4;
            nBtnNumber4 = 3;
            nBtnQuit = 1;
        }
    });
    //点击按钮“退出”显示菜单
    connect(ui->btnQuit,&QPushButton::clicked,[=](){
        if(state[13] == 1)
        {
            switch (nBtnQuit)
            {
            case 1://开功能界面点退出到菜单界面
            {
                profileCurveStop = 0;
                emit showMenu();

                //数字键1~8可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 0;
                nBtnNumber1 = 3;//点击1到设置参数界面
                nBtnNumber2 = 2;//点击退出后到菜单
                nBtnNumber5 = 14;//点击5显示剖面
                timerStop = 0;
                plot->hide();
                points2.clear();
                pointTemp = points1;
                pointNumber = 0;
                plot->detachItems();//擦除重绘
                break;
            }
            case 2://第一个参数设置界面点退出取消操作
            {
                data[0] = 0;
                data[1] = 0;
                data[2] = 0;//输入数据清0
                timerStop = 0;
                parameterSetting();
                countInputNumber = 1;
                break;
            }
            case 3://第二个参数设置界面点退出取消操作
            {
                data2[0] = 0;
                data2[1] = 0;
                data2[2] = 0;//输入数据清0
                timerStop2 = 0;
                parameterSettingAfterOK();
                countInputNumber = 1;
                break;
            }

            case 4://第一个参数设置界面点退出取消操作
            {
                dataMeasure[0] = 0;
                dataMeasure[1] = 0;
                dataMeasure[2] = 0;//输入数据清0
                timerStopMeasure = 0;
                measureMethod();
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 4;
                nBtnNumber1 = 8;
                nBtnNumber2 = 8;
                nBtnNumber3 = 7;
                nBtnNumber4 = 6;
                nBtnNumber5 = 5;
                nBtnNumber6 = 4;
                nBtnNumber7 = 4;
                nBtnNumber8 = 4;
                nBtnNumber9 = 4;
                nBtnOK = 6;
                nBtnQuit = 4;
                countInputNumberMeasure = 1;
                break;
            }
            case 5://第二个参数设置界面点退出取消操作
            {
                dataMeasure2[0] = 0;
                dataMeasure2[1] = 0;
                dataMeasure2[2] = 0;//输入数据清0
                timerStopMeasure2 = 0;
                measureAfterFirstOk();
                countInputNumberMeasure = 1;
                saveDataMeasure2 = arrayData[2];
                break;
            }
            case 6://设置使用电极数界面点退出取消操作
            {
                arrayDataCount[0] = 0;
                arrayDataCount[1] = 0;//输入数据清0
                arrayStop = 0;
                ui->tableWidget->selectRow(2);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,2);
                //数字键、确认、退出键可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 6;
                nBtnNumber1 = 11;
                nBtnNumber2 = 11;
                nBtnNumber3 = 10;
                nBtnNumber4 = 9;
                nBtnNumber5 = 8;
                nBtnNumber6 = 7;
                nBtnNumber7 = 7;
                nBtnNumber8 = 7;
                nBtnNumber9 = 7;
                nBtnOK = 10;
                nBtnQuit = 6;
                countArrayInputNumber = 1;
                break;
            }

            case 7://设置点距界面点退出取消操作
            {
                arrayDataCount[0] = 0;
                arrayDataCount[1] = 0;//输入数据清0
                arrayStop = 0;
                ui->tableWidget->selectRow(3);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,3);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                countArrayInputNumber = 1;
                //对应按键状态
                nBtnNumber0 = 7;
                nBtnNumber1 = 12;
                nBtnNumber2 = 12;
                nBtnNumber3 = 11;
                nBtnNumber4 = 10;
                nBtnNumber5 = 9;
                nBtnNumber6 = 8;
                nBtnNumber7 = 8;
                nBtnNumber8 = 8;
                nBtnNumber9 = 8;
                nBtnOK = 11;
                nBtnQuit = 7;
                break;
            }
            case 8://设置剖面数界面点退出取消操作
            {
                arrayDataCount[0] = 0;
                arrayDataCount[1] = 0;//输入数据清0
                arrayStop = 0;
                ui->tableWidget->selectRow(4);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,4);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                countArrayInputNumber = 1;
                //对应按键状态
                nBtnNumber0 = 8;
                nBtnNumber1 = 13;
                nBtnNumber2 = 13;
                nBtnNumber3 = 12;
                nBtnNumber4 = 11;
                nBtnNumber5 = 10;
                nBtnNumber6 = 9;
                nBtnNumber7 = 9;
                nBtnNumber8 = 9;
                nBtnNumber9 = 9;
                nBtnOK = 12;
                nBtnQuit = 8;
                break;
            }
            case 9://测量-取消输入第一个参数实接电极数
            {
                measureSaveData[0] = 0;
                measureSaveData[1] = 0;//输入数据清0
                measureStop = 0;
                countMeasureInput = 1;//重置输入个数
//                ui->tableWidget->selectRow(/*4*/);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                measureInputData(measureInputString,1);
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 9;
                nBtnNumber1 = 14;
                nBtnNumber2 = 14;
                nBtnNumber3 = 13;
                nBtnNumber4 = 12;
                nBtnNumber5 = 11;
                nBtnNumber6 = 10;
                nBtnNumber7 = 10;
                nBtnNumber8 = 10;
                nBtnNumber9 = 10;
                nBtnOK = 13;
                nBtnQuit = 9;
                break;
            }
            case 10://测量-取消输入第二个参数电极号
            {
                measureSaveData[0] = 0;
                measureSaveData[1] = 0;//输入数据清0
                measureStop = 0;
                countMeasureInput = 1;//重置输入个数
//                ui->tableWidget->selectRow(/*4*/);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                measureInputData(measureInputString,2);
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 10;
                nBtnNumber1 = 15;
                nBtnNumber2 = 15;
                nBtnNumber3 = 14;
                nBtnNumber4 = 13;
                nBtnNumber5 = 12;
                nBtnNumber6 = 11;
                nBtnNumber7 = 11;
                nBtnNumber8 = 11;
                nBtnNumber9 = 11;
                nBtnOK = 14;
                nBtnQuit = 10;
                break;
            }
            case 11://高密度方式-设置供电时间点退出
            {
                highDensityData[0] = 0;
                highDensityData[1] = 0;//输入数据清0
                sleepStop = 0;
                highDensityCount = 1;//重置输入个数
//                ui->tableWidget->selectRow(/*4*/);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                int temp = 1;
                while(sleepStop == 0)
                {
                    if(temp == 1)
                    {
                        showTableWidgetStr("供电时间:5_");
                        sleepQt(500);
                        temp = -temp;
                    }
                    else
                    {
                        showTableWidgetStr("供电时间:5 ");
                        sleepQt(500);
                        temp = -temp;
                    }
                    //数字键、确认键、退出键可用
                    highDensityDataAll = 5;
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 11;
                    nBtnNumber1 = 16;
                    nBtnNumber2 = 16;
                    nBtnNumber3 = 15;
                    nBtnNumber4 = 14;
                    nBtnNumber5 = 13;
                    nBtnNumber6 = 12;
                    nBtnNumber7 = 12;
                    nBtnNumber8 = 12;
                    nBtnNumber9 = 12;
                    nBtnOK = 16;
                    nBtnQuit = 11;
                }
                break;
            }
            case 12://显示剖面曲线-设置第一个参数断面号-点退出
            {
                profileCurveData[0] = 0;
                profileCurveData[1] = 0;
                profileCurveData[2] = 0;//重置数据
                profileCurveCount = 1;
                profileCurveStop = 0;

                int temp = 1;
                QStringList list;
                while(profileCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示剖面曲线"
                        <<"输入断面号：___"
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示剖面曲线"
                        <<"输入断面号：   "
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 12;
                    nBtnNumber1 = 17;
                    nBtnNumber2 = 17;
                    nBtnNumber3 = 16;
                    nBtnNumber4 = 15;
                    nBtnNumber5 = 15;
                    nBtnNumber6 = 13;
                    nBtnNumber7 = 13;
                    nBtnNumber8 = 13;
                    nBtnNumber9 = 13;
                    nBtnOK = 17;
                    nBtnQuit = 12;
                }
                break;
            }
            case 13://显示剖面曲线-设置第二个参数剖面号-点退出
            {
                profileCurveData[0] = 0;
                profileCurveData[1] = 0;
                profileCurveData[2] = 0;
                profileCurveStop = 0;
                profileCurveCount = 1;
                int temp = 1;
                QStringList list;
                QString strTemp = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
                while(profileCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示剖面曲线"
                        <<strTemp
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示剖面曲线"
                        <<strTemp
                        <<"输入剖面号：   "
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 13;
                    nBtnNumber1 = 18;
                    nBtnNumber2 = 18;
                    nBtnNumber3 = 17;
                    nBtnNumber4 = 16;
                    nBtnNumber5 = 16;
                    nBtnNumber6 = 14;
                    nBtnNumber7 = 14;
                    nBtnNumber8 = 14;
                    nBtnNumber9 = 14;
                    nBtnOK = 18;
                    nBtnQuit = 13;
                }
                break;
            }
            case 14://完成测量后点退出到测量菜单
            {
                emit measureMenu();
//                nBtnNumber2 = 3;//点击2后达到测量界面
                //                qDebug()<<nBtnNumber;

                //                qDebug()<<nBtnNumber5;
                //此时在测量界面
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 0;

                //按键状态改变
                nBtnNumber1 = 7;
                nBtnNumber2 = 7;
                nBtnNumber3 = 2;
                nBtnNumber4 = 1;
                nBtnNumber5 = 1;

                dataMeasure[0] = 0;
                dataMeasure[1] = 0;
                dataMeasure[2] = 0;
                dataMeasure2[0] = 0;
                dataMeasure2[1] = 0;
                dataMeasure2[2] = 0;
                timerStopMeasure = 0;
                break;
            }

                /////
            case 15://显示断面曲线-设置第一个参数断面号-点退出
            {
                sectionCurveData[0] = 0;
                sectionCurveData[1] = 0;
                sectionCurveData[2] = 0;//重置数据
                sectionCurveCount = 1;
                sectionCurveStop = 0;

                int temp = 1;
                QStringList list;
                while(sectionCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示断面曲线"
                        <<"输入断面号：___"
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示剖面曲线"
                        <<"输入断面号：   "
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 14;
                    nBtnNumber1 = 19;
                    nBtnNumber2 = 19;
                    nBtnNumber3 = 18;
                    nBtnNumber4 = 18;
                    nBtnNumber5 = 18;
                    nBtnNumber6 = 17;
                    nBtnNumber7 = 15;
                    nBtnNumber8 = 16;
                    nBtnNumber9 = 15;
                    nBtnOK = 20;
                    nBtnQuit = 15;
                }
                break;
            }
            case 16://显示剖面曲线-设置第二个参数剖面号-点退出
            {
                sectionCurveData[0] = 0;
                sectionCurveData[1] = 0;
                sectionCurveData[2] = 0;
                sectionCurveStop = 0;
                sectionCurveCount = 1;
                int temp = 1;
                QStringList list;
                QString strTemp = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
                while(sectionCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示断面曲线"
                        <<strTemp
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示断面曲线"
                        <<strTemp
                        <<"输入剖面号：   "
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 15;
                    nBtnNumber1 = 20;
                    nBtnNumber2 = 20;
                    nBtnNumber3 = 19;
                    nBtnNumber4 = 19;
                    nBtnNumber5 = 19;
                    nBtnNumber6 = 18;
                    nBtnNumber7 = 16;
                    nBtnNumber8 = 17;
                    nBtnNumber9 = 16;
                    nBtnOK = 21;
                    nBtnQuit = 16;
                }
                break;
            }
            }

        }
    });

    //按钮±响应
    connect(ui->btnPlus,&QPushButton::clicked,[=](){
        if(state[15] == 1)
        {
            switch (nBtnPlus)
            {
            case 1://选择排列->
            {
                if(arrayCount == 2)
                {
                    arrayCount = 0;
                }
                else
                {
                    arrayCount ++;
                }
                QStringList list;
                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                arrayStop = 1;
                showTableWidgetStrList(list);
                //只有±、·、确认 可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 1;

                nBtnPlus = 1;
                nBtnPoint = 1;
                nBtnOK = 8;
                break;
            }
            case 2://显示剖面曲线-实现放大缩小
            {
                QMessageBox::information(this,"提示","_请使用鼠标缩放曲线_");
                //只有4、5、6、8、±、·、退出键可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 0;

                nBtnQuit = 1;
                nBtnPlus = 2;
                nBtnPoint = 2;
                nBtnNumber4 = 17;
                nBtnNumber5 = 17;
                nBtnNumber6 = 15;
                nBtnNumber8 = 15;
                break;
            }
            }
        }
    });

    //按钮.响应
    connect(ui->btnPoint,&QPushButton::clicked,[=](){
        if(state[16] == 1)
        {
            switch (nBtnPlus)
            {
            case 1://选择排列->
            {
                if(arrayCount == 0)
                {
                    arrayCount = 2;
                }
                else
                {
                    arrayCount --;
                }
                QStringList list;
                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                arrayStop = 1;
                showTableWidgetStrList(list);
                //只有±、·、确认 可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 1;

                nBtnPlus = 1;
                nBtnPoint = 1;
                nBtnOK = 8;
                break;
            }
            case 2://显示剖面曲线-实现放大缩小
            {
                QMessageBox::information(this,"提示","_请使用鼠标缩放曲线_");
                //只有4、5、6、8、±、·、退出键可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 0;

                nBtnQuit = 1;
                nBtnPlus = 2;
                nBtnPoint = 2;
                nBtnNumber4 = 17;
                nBtnNumber5 = 17;
                nBtnNumber6 = 15;
                nBtnNumber8 = 15;
                break;
            }
            }
        }
    });

    //按钮确认
    connect(ui->btnOK,&QPushButton::clicked,[=](){
        if(state[17] == 1)
        {
            switch (nBtnOK)
            {
            case 1:
            {
                QStringList list;
                list<<"_请打开电极箱电源_";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                //此时还是点击确认
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                nBtnOK = 2;//切换到确认键第二种状态
                break;
            }
            case 2:
            {
                ui->tableWidget->setRowCount(1);
                QTableWidgetItem * item = new QTableWidgetItem("指示灯闪烁，打开成功,进入扫描测量");
                ui->tableWidget->setItem(0,0,item);
                ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                //this->addItem(file.at(i));

                QTimer *timer = new QTimer(this);
                timer->start(2500);
                connect(timer,&QTimer::timeout,[=](){
                    count = count + 1;
                    if(count == 1)
                    {
//                        //产生随机数
//                        QTime time;
//                        time= QTime::currentTime();
//                        qsrand(time.msec()+time.second()*1000);
//                        int n = qrand() % 20000; //产生5以内的随机数
//                        double x = n * 1.156;
                        x = randNumber(20000);
                        ui->tableWidget->setRowCount(1);
                        QString str = QString("R=%1 Ω, A=1").arg(x);
                        QTableWidgetItem * item = new QTableWidgetItem(str);
                        ui->tableWidget->setItem(0,0,item);
                        ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                        //this->addItem(file.at(i));
                    }
                    if(count >= 2)
                    {
                        timer->stop();
                        measureMenu();
                        count = 0;

                        //此时在测量界面
                        state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                        state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                        state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                        state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                        state[16] = 0;state[17] = 0;
                        //测量界面
                        nBtnNumber3 = 2;
                        nBtnNumber5 = 1;
                    }

                });
                break;
            }
            case 3://测量-电极箱电压测试
            {
                x = randNumber(20000);
                if(x<9600)
                {
                    ui->tableWidget->setRowCount(2);
                    QTableWidgetItem * item = new QTableWidgetItem("_电极箱电压过低_");
                    ui->tableWidget->setItem(1,0,item);
                    ui->tableWidget->item(1,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                else
                {
                    ui->tableWidget->setRowCount(2);
                    QTableWidgetItem * item = new QTableWidgetItem("电池电压正常!");
                    ui->tableWidget->setItem(1,0,item);
                    ui->tableWidget->item(1,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                QTimer *timer = new QTimer(this);
                timer->start(2500);
                connect(timer,&QTimer::timeout,[=](){
                    measureMenu();
                    //此时在测量界面
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 0;
                    //测量界面
//                    nBtnNumber1 = 1;
//                    nBtnNumber2 = 1;
                    nBtnNumber3 = 2;
                    nBtnNumber4 = 1;
                    nBtnNumber5 = 1;
//                    nBtnNumber6 = 1;
                    timer->stop();
                });
                break;
            }
            case 4://参数设置界面点击确认
            {
                timerStop2 = 0;
                countInputNumber = 1;
                parameterSettingAfterOK();
                break;
            }
            case 5://第二个参数输入完成后点确定
            {                  
                        QStringList list;
//                        flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                        flashingStr[1] = "滚动总数:__";
                        flashingStr[2] = "使用电极数：__";
                        flashingStr[3] = "点距:_._";
                        flashingStr[4] = "剖面数：__";
                        flashingStr[5] = "点数:___";
                        arrayFlashing(flashingStr,0);


//                nBtnNumber1 = 3;//点击1到设置参数界面
//                nBtnNumber2 = 2;//点击退出后到菜单
//                timerStop = 0;
//                countInputNumber = 1;

                        //只有±、·、确认 可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 0;

                nBtnPlus = 1;
                nBtnPoint = 1;
//                nBtnOK = 8;
                break;
            }

            case 6://测量-起始剖面号输入完后点确认
            {
//                qDebug()<<saveDataMeasure;
                QString str = QString("起始剖面号超出最大剖面号%1").arg(arrayData[2]);
                if(saveDataMeasure > arrayData[2])
                {
                    QMessageBox::critical(this,"参数错误",str,
                                                      "请点退出键重新输入");
                }
                else
                {
                    measureAfterFirstOk();
                }
                break;
            }
            case 7://测量-终止剖面号也完成确认
            {
//                QMessageBox::information(this,"1","233");
                QString str = QString("结束剖面号超出最大剖面号%1").arg(arrayData[2]);
                if(saveDataMeasure2 == 0)
                {
                    saveDataMeasure2 = arrayData[2];//如果结束剖面号不设置，就用默认的最大剖面号
                    timerStopMeasure = 1;
                    timerStopMeasure2 = 1;
                }
//                measureInputString[0] =
                if(saveDataMeasure2 > arrayData[2])
                {
//                    qDebug()<<saveDataMeasure2;
                    QMessageBox::critical(this,"参数错误",str,
                                                      "请点退出键重新输入");
                    break;
                }
                measureInputData(measureInputString,1);
                    //输入第一个参数-实接电极数
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 9;
                    nBtnNumber1 = 14;
                    nBtnNumber2 = 14;
                    nBtnNumber3 = 13;
                    nBtnNumber4 = 12;
                    nBtnNumber5 = 11;
                    nBtnNumber6 = 10;
                    nBtnNumber7 = 10;
                    nBtnNumber8 = 10;
                    nBtnNumber9 = 10;
                    nBtnOK = 13;
                    nBtnQuit = 9;

                break;
            }
            case 8://选择好排列后点确定
            {
                arrayStop = 0;
                ui->tableWidget->selectRow(1);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,1);

                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;


                break;
            }
            case 9://滚动总数输入完成后点确定
            {
                arrayStop = 0;
                ui->tableWidget->selectRow(2);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,2);
                //数字键、确认、退出键可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 6;
                nBtnNumber1 = 11;
                nBtnNumber2 = 11;
                nBtnNumber3 = 10;
                nBtnNumber4 = 9;
                nBtnNumber5 = 8;
                nBtnNumber6 = 7;
                nBtnNumber7 = 7;
                nBtnNumber8 = 7;
                nBtnNumber9 = 7;
                nBtnOK = 10;
                nBtnQuit = 6;
                break;
            }
            case 10://使用电极数输入完成后点确定
            {
                arrayStop = 0;
                ui->tableWidget->selectRow(3);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,3);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                countArrayInputNumber = 1;
                //对应按键状态
                nBtnNumber0 = 7;
                nBtnNumber1 = 12;
                nBtnNumber2 = 12;
                nBtnNumber3 = 11;
                nBtnNumber4 = 10;
                nBtnNumber5 = 9;
                nBtnNumber6 = 8;
                nBtnNumber7 = 8;
                nBtnNumber8 = 8;
                nBtnNumber9 = 8;
                nBtnOK = 11;
                nBtnQuit = 7;
                break;
            }

            case 11://点距输入完成后点确定
            {
                arrayStop = 0;
                ui->tableWidget->selectRow(4);
//                flashingStr[0] = QString("装置:%1").arg(arrangement[arrayCount]);
                arrayFlashing(flashingStr,4);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                countArrayInputNumber = 1;
                //对应按键状态
                nBtnNumber0 = 8;
                nBtnNumber1 = 13;
                nBtnNumber2 = 13;
                nBtnNumber3 = 12;
                nBtnNumber4 = 11;
                nBtnNumber5 = 10;
                nBtnNumber6 = 9;
                nBtnNumber7 = 9;
                nBtnNumber8 = 9;
                nBtnNumber9 = 9;
                nBtnOK = 12;
                nBtnQuit = 8;
                break;
            }
            case 12://剖面数输入完成后点确定-计算总点数
            {
                arrayStop = 0;

                ui->tableWidget->selectRow(5);
                //计算总点数
                for(int i = 1;i<=arrayData[2];i++)
                {
                    totalPoint = arrayData[1]-3*i+totalPoint;
                }
//                qDebug()<<totalPoint;
                QStringList list;
                flashingStr[5] = QString("点数:%1").arg(totalPoint);
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //只有退出键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 0;
                countArrayInputNumber = 1;
                //对应按键状态
                nBtnQuit = 1;
                break;
            }
            case 13://测量参数-输入第一个参数后确定，判断
            {
                QString str = QString("实接电极数不能小于使用电极数%1").arg(arrayData[1]);
                if(measureSaveDataAll[0] < arrayData[1])
                {
                    QMessageBox::critical(this,"参数错误",str,
                                                      "请点退出键重新输入");
                }
                else
                {
                    measureStop = 0;
                    countMeasureInput = 1;
                    measureInputData(measureInputString,2);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 10;
                    nBtnNumber1 = 15;
                    nBtnNumber2 = 15;
                    nBtnNumber3 = 14;
                    nBtnNumber4 = 13;
                    nBtnNumber5 = 12;
                    nBtnNumber6 = 11;
                    nBtnNumber7 = 11;
                    nBtnNumber8 = 11;
                    nBtnNumber9 = 11;
                    nBtnOK = 14;
                    nBtnQuit = 10;
                }
                break;
            }
            case 14://测量界面-输入完电极号-判断
            {
                int isFlow;
                isFlow = measureSaveDataAll[0] - arrayData[2] + 1;
                if(measureSaveDataAll[1] <= 0 | measureSaveDataAll[1] > isFlow)
                {
                    QString str = QString("可输入范围为:1~%1").arg(isFlow);
                    QMessageBox::critical(this,"参数错误",str,
                                                      "请点退出键重新输入");

                }
                else
                {
                    countMeasureInput = 1;
                    measureStop = 0;
                    measureInputData(measureInputString,3);
                    QMessageBox::information(this,"提示","当前为固定断面测量方式，滚动号必须为1",
                                             "_请点击确认执行测量_");
                }
                //仅仅只有确认可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                nBtnOK = 15;
                break;
            }
            case 15://点击确认进行测量
            {
                QStringList list;
                QString strDemo[5][8];
                measureStop = 1;
                strDemo[0][0] = "_正在测量中……_";
                strDemo[0][1] = "_断面号：1_";
                strDemo[0][2] = "剖面号：1";
                strDemo[0][3] = "Ro=223.87";
                strDemo[0][4] = "VP=3451.43  IP=29.05";
                strDemo[0][5] = "No.1";
                strDemo[0][6] = "A = 1  B = 2";
                strDemo[0][7] = "M = 3  N = 4";

                strDemo[1][0] = "_正在测量中……_";
                strDemo[1][1] = "_断面号：1_";
                strDemo[1][2] = "剖面号：1";
                strDemo[1][3] = "Ro=223.15";
                strDemo[1][4] = "VP=3551.51  IP=29.99";
                strDemo[1][5] = "No.2";
                strDemo[1][6] = "A = 2  B = 3";
                strDemo[1][7] = "M = 4  N = 5";

                strDemo[2][0] = "_正在测量中……_";
                strDemo[2][1] = "_断面号：1_";
                strDemo[2][2] = "剖面号：1";
                strDemo[2][3] = "Ro=220.47";
                strDemo[2][4] = "VP=2222.90  IP=19.00";
                strDemo[2][5] = "No.3";
                strDemo[2][6] = "A = 3  B = 4";
                strDemo[2][7] = "M = 5  N = 6";

                strDemo[3][0] = "_正在测量中……_";
                strDemo[3][1] = "_断面号：1_";
                strDemo[3][2] = "剖面号：1";
                strDemo[3][3] = "Ro=264.29";
                strDemo[3][4] = "VP=2928.58  IP=20.88";
                strDemo[3][5] = "No.4";
                strDemo[3][6] = "A = 4  B = 5";
                strDemo[3][7] = "M = 6  N = 7";

                strDemo[4][0] = "_正在测量中……_";
                strDemo[4][1] = "_断面号：1_";
                strDemo[4][2] = "剖面号：1";
                strDemo[4][3] = "Ro=281.89";
                strDemo[4][4] = "VP=3778.82  IP=25.26";
                strDemo[4][5] = "No.5";
                strDemo[4][6] = "A = 5  B = 6";
                strDemo[4][7] = "M = 7  N = 8";
                for(int j = 0;j < 5 ;j++)
                {
                    //按键禁用
                    state[0] = 0;state[1] = 0;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 0;
                    for(int i = 0; i < 8;i++)
                    {
                        list<<strDemo[j][i];
                        showTableWidgetStrList(list);
                        sleepQt(1000);
                    }
                    list.clear();

                }
                QMessageBox::information(this,"提示","模拟测量完成","请按退出键返回");
                    //只有退出键可用
                    //只有退出键可用
                    highDensityDataAll = 5;
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 0;

                    //对应按键状态
                    nBtnQuit = 14;
                    nBtnNumber1 = 7;
                    nBtnNumber2 = 7;
                    nBtnNumber3 = 2;//测量主机电池电压，测量-电池电压
                    nBtnNumber4 = 1;
                    nBtnNumber5 = 1;

                    measureSaveData[0] = 0;
                    measureSaveData[1] = 0;
                break;

            }
            case 16://高密度方式-设置供电时间点确认
            {
                if(highDensityDataAll > 10)
                {
                    QMessageBox::critical(this,"参数错误","供电时间有效数为:1~10","_请点击退出重新输入_");
                    //只有退出键可用
                    highDensityDataAll = 5;
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 0;

                    //对应按键状态
                    nBtnQuit = 11;
                }
                else
                {
                    highDensity = 0;
                    sleepStop = 1;
                    emit measureMenu();
                    //此时在测量界面
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 0;

                    nBtnNumber1 = 7;
                    nBtnNumber2 = 7;
                    nBtnNumber3 = 2;//测量主机电池电压，测量-电池电压
                    nBtnNumber4 = 1;
                    nBtnNumber5 = 1;
//                    qDebug()<<nBtnNumber1;
                }
                break;
            }
            case 17://显示剖面曲线-设置断面号点确定
            {
                profileCurveData[0] = 0;
                profileCurveData[1] = 0;
                profileCurveData[2] = 0;
                profileCurveStop = 0;
                profileCurveCount = 1;
                int temp = 1;
                QStringList list;
                QString strTemp = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
                while(profileCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示剖面曲线"
                        <<strTemp
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示剖面曲线"
                        <<strTemp
                        <<"输入剖面号：   "
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 13;
                    nBtnNumber1 = 18;
                    nBtnNumber2 = 18;
                    nBtnNumber3 = 17;
                    nBtnNumber4 = 16;
                    nBtnNumber5 = 16;
                    nBtnNumber6 = 14;
                    nBtnNumber7 = 14;
                    nBtnNumber8 = 14;
                    nBtnNumber9 = 14;
                    nBtnOK = 18;
                    nBtnQuit = 13;
                }
                break;
            }

            case 18://输入完成剖面号后点确定-显示剖面曲线
            {

//                ui->qwtPlot->show();
//                qwtPlot *plot = new qwtPlot(this);
//                QPolygonF points1,points2;//输入节点数据QPointF(x,y)

                QStringList list;
                QString str1 = QString("Ro=%1 NL=100").arg(points1[0].y());
                QString str2 = QString("ND= %1").arg(points1[0].x());
                list<<str1
                        <<str2;
                showTableWidgetStrList(list);
                points2<<points1.at(0);
//                qDebug()<<points2.size();
                plot->setParent(this);
                plot->initialization(0.,22.,150.,330.);
                plot->paintPlot(points1,points2);

//                QwtPlotMarker *maker = new QwtPlotMarker;
                plot->move(100,200);
                plot->setGeometry(30,180,351,191);
                plot->show();

                //只有4、5、6、8、±、·、退出键可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 0;

                nBtnQuit = 1;
                nBtnPlus = 2;
                nBtnPoint = 2;
                nBtnNumber4 = 17;
                nBtnNumber5 = 17;
                nBtnNumber6 = 15;
                nBtnNumber8 = 15;
                break;
            }
            case 19://程序优化修改：点击确定到菜单
            {
                profileCurveStop = 0;
                emit showMenu();

                //数字键1~8可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 0;
                nBtnNumber1 = 3;//点击1到设置参数界面
                nBtnNumber2 = 2;//点击退出后到菜单
                nBtnNumber5 = 14;//点击5显示剖面
                nBtnNumber6 = 16;//点击5显示剖面
                timerStop = 0;
                plot->hide();
                break;
            }

                //////
            case 20://显示剖面曲线-设置断面号点确定
            {
                sectionCurveData[0] = 0;
                sectionCurveData[1] = 0;
                sectionCurveData[2] = 0;
                sectionCurveStop = 0;
                sectionCurveCount = 1;
                int temp = 1;
                QStringList list;
                QString strTemp = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
                while(sectionCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示断面曲线"
                        <<strTemp
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示断面曲线"
                        <<strTemp
                        <<"输入剖面号：   "
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 15;
                    nBtnNumber1 = 20;
                    nBtnNumber2 = 20;
                    nBtnNumber3 = 19;
                    nBtnNumber4 = 19;
                    nBtnNumber5 = 19;
                    nBtnNumber6 = 18;
                    nBtnNumber7 = 16;
                    nBtnNumber8 = 17;
                    nBtnNumber9 = 16;
                    nBtnOK = 21;
                    nBtnQuit = 16;
                }
                break;
            }

            case 21://输入完成剖面号后点确定-显示断面曲线
            {

                plot->setParent(this);
                plot->initializationSeven(0.,22.,100.,1800.);
                plot->paintSevenPlot(point0,point1,point2,point3,point4,point5,point6);

//                QwtPlotMarker *maker = new QwtPlotMarker;
                plot->setGeometry(30,60,381,321);
                plot->show();

//                //只有4、5、6、8、±、·、退出键可用
//                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
//                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
//                state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
//                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
//                state[16] = 1;state[17] = 0;

//                nBtnQuit = 1;
//                nBtnPlus = 2;
//                nBtnPoint = 2;
//                nBtnNumber4 = 17;
//                nBtnNumber5 = 17;
//                nBtnNumber6 = 15;
//                nBtnNumber8 = 15;
                break;
            }
            }
            }

    });

    //按钮0
    connect(ui->btn0,&QPushButton::clicked,[=](){
        if(state[14] == 1)
        {
            switch (nBtnNumber0)
            {
            case 1://测量-接地电阻界面
            {
                QStringList list;
                list<<"接地端电极为N";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                nBtnOK = 1;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 2://设置参数界面-输入0
            {
//                qDebug()<<2;
                switch (countInputNumber)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    data[1] = 0;//保存在数组中间
                    timerStop = 1;
                    QStringList list;
                    QString str = QString("输入断面号：_%1").arg(data[1]+data[0]*10);
                    list<<"选择工作断面"
                          <<str
                          <<"输入剖面号：___"
                          <<"确认─执行操作"
                          <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    countInputNumber++;
                    saveData = data[1]+data[0]*10;
                    break;
                }
                case 3://0是第三个数
                {
                    data[2] = 0;//保存在数组最后
                    timerStop = 1;
                    QStringList list;
                    QString str = QString("输入断面号：%1").arg(data[2]+data[1]*10+data[0]*100);
                    list<<"选择工作断面"
                          <<str
                          <<"输入剖面号：___"
                          <<"确认─执行操作"
                          <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    countInputNumber++;
                    saveData = data[2]+data[1]*10+data[0]*100;
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 2;
                nBtnNumber1 = 5;
                nBtnNumber2 = 5;
                nBtnNumber3 = 5;
                nBtnNumber4 = 4;
                nBtnNumber5 = 3;
                nBtnNumber6 = 2;
                nBtnNumber7 = 2;
                nBtnNumber8 = 2;
                nBtnNumber9 = 2;
                nBtnOK = 4;
                nBtnQuit = 2;
                break;
            }
            case 3://设置参数界面-输入0-输入第二个参数剖面号
            {
//                qDebug()<<2;
                switch (countInputNumber)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    data2[1] = 0;//保存在数组中间
                    timerStop2 = 1;
                    QStringList list;
                    QString str = QString("输入断面号：%1").arg(saveData);
                    QString str2 = QString("输入剖面号：_%1").arg(data2[1]+data2[0]*10);
                    list<<"选择工作断面"
                          <<str
                          <<str2
                          <<"确认─执行操作"
                          <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    countInputNumber++;
                    break;
                }
                case 3://0是第三个数
                {
                    data2[2] = 0;//保存在数组最后
                    timerStop2 = 1;
                    QStringList list;
                    QString str = QString("输入断面号：%1").arg(saveData);
                    QString str2 = QString("输入剖面号：%1").arg(data2[1]*10+data2[0]*100+data2[2]);
                    list<<"选择工作断面"
                          <<str
                          <<str2
                          <<"确认─执行操作"
                          <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    countInputNumber++;
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 3;
                nBtnNumber1 = 6;
                nBtnNumber2 = 6;
                nBtnNumber3 = 6;
                nBtnNumber4 = 5;
                nBtnNumber5 = 4;
                nBtnNumber6 = 3;
                nBtnNumber7 = 3;
                nBtnNumber8 = 3;
                nBtnNumber9 = 3;
                nBtnOK = 5;
                nBtnQuit = 3;
                break;
            }

                /////
            case 4://测量参数设置-设置参数界面-输入0
            {
//                qDebug()<<2;
                switch (countInputNumberMeasure)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    dataMeasure[1] = 0;//保存在数组中间
                    timerStopMeasure = 1;
                    QStringList list;
                    QString str = QString("输入起始剖面号：_%1").arg(dataMeasure[1]+dataMeasure[0]*10);
                    list<<str
                          <<"输入结束剖面号：___";
                    showTableWidgetStrList(list);
                    countInputNumberMeasure++;
                    saveDataMeasure = dataMeasure[1]+dataMeasure[0]*10;
                    break;
                }
                case 3://0是第三个数
                {
                    dataMeasure[2] = 0;//保存在数组最后
                    timerStopMeasure = 1;
                    QStringList list;
                    QString str = QString("输入起始剖面号：%1").arg(dataMeasure[2]+dataMeasure[1]*10+dataMeasure[0]*100);
                    list<<str
                          <<"输入结束剖面号：___";
                    showTableWidgetStrList(list);
                    countInputNumberMeasure++;
                    saveDataMeasure = dataMeasure[2]+dataMeasure[1]*10+dataMeasure[0]*100;
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 4;
                nBtnNumber1 = 8;
                nBtnNumber2 = 8;
                nBtnNumber3 = 7;
                nBtnNumber4 = 6;
                nBtnNumber5 = 5;
                nBtnNumber6 = 4;
                nBtnNumber7 = 4;
                nBtnNumber8 = 4;
                nBtnNumber9 = 4;
                nBtnOK = 6;
                nBtnQuit = 4;
                break;
            }
            case 5://测量参数设置-设置参数界面-输入0-输入第二个参数剖面号
            {
//                qDebug()<<2;
                switch (countInputNumberMeasure)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    dataMeasure2[1] = 0;//保存在数组中间
                    timerStopMeasure2 = 1;
                    QStringList list;
                    QString str = QString("输入起始剖面号：%1").arg(saveDataMeasure);
                    QString str2 = QString("输入结束剖面号：_%1").arg(dataMeasure2[1]+dataMeasure2[0]*10);
                    list<<str
                         <<str2;
                    showTableWidgetStrList(list);
                    countInputNumberMeasure++;
                    break;
                }
                case 3://0是第三个数
                {
                    dataMeasure2[2] = 0;//保存在数组最后
                    timerStopMeasure2 = 1;
                    QStringList list;
                    QString str = QString("输入起始剖面号：%1").arg(saveDataMeasure);
                    QString str2 = QString("输入结束剖面号：%1").arg(dataMeasure2[1]*10+dataMeasure2[0]*100+dataMeasure2[2]);
                    list<<str
                         <<str2;
                    showTableWidgetStrList(list);
                    countInputNumberMeasure++;
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 5;
                nBtnNumber1 = 9;
                nBtnNumber2 = 9;
                nBtnNumber3 = 8;
                nBtnNumber4 = 7;
                nBtnNumber5 = 6;
                nBtnNumber6 = 5;
                nBtnNumber7 = 5;
                nBtnNumber8 = 5;
                nBtnNumber9 = 5;
                nBtnOK = 7;
                nBtnQuit = 5;
                break;
            }

                ////
            case 6://设置使用电极数-输入0
            {
//                qDebug()<<2;
                switch (countArrayInputNumber)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    arrayDataCount[1] = 0;//保存在数组中
                    arrayStop = 1;
                    QStringList list;
                    flashingStr[2] = QString("使用电极数：%1").arg(arrayDataCount[1]+arrayDataCount[0]*10);
                    list<<flashingStr[0]
                            <<flashingStr[1]
                            <<flashingStr[2]
                            <<flashingStr[3]
                            <<flashingStr[4]
                            <<flashingStr[5];
                    showTableWidgetStrList(list);
                    countArrayInputNumber++;
                    arrayData[1] = arrayDataCount[1]+arrayDataCount[0]*10;
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 6;
                nBtnNumber1 = 11;
                nBtnNumber2 = 11;
                nBtnNumber3 = 10;
                nBtnNumber4 = 9;
                nBtnNumber5 = 8;
                nBtnNumber6 = 7;
                nBtnNumber7 = 7;
                nBtnNumber8 = 7;
                nBtnNumber9 = 7;
                nBtnOK = 10;
                nBtnQuit = 6;
                break;
            }
            case 7://设置使用点距-输入0
            {
//                qDebug()<<2;
                switch (countArrayInputNumber)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    arrayDataCount[1] = 0;//保存在数组中
                    arrayStop = 1;
                    QStringList list;
                    flashingStr[3] = QString("点距:%1.%2").arg(arrayDataCount[0]).arg(arrayDataCount[1]);
                    list<<flashingStr[0]
                            <<flashingStr[1]
                            <<flashingStr[2]
                            <<flashingStr[3]
                            <<flashingStr[4]
                            <<flashingStr[5];
                    showTableWidgetStrList(list);
                    countArrayInputNumber++;
                    dotPitch = arrayDataCount[1]*0.1+arrayDataCount[0];
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 7;
                nBtnNumber1 = 12;
                nBtnNumber2 = 12;
                nBtnNumber3 = 11;
                nBtnNumber4 = 10;
                nBtnNumber5 = 9;
                nBtnNumber6 = 8;
                nBtnNumber7 = 8;
                nBtnNumber8 = 8;
                nBtnNumber9 = 8;
                nBtnOK = 11;
                nBtnQuit = 7;
                break;
            }
            case 8://设置剖面数-输入0
            {
//                qDebug()<<2;
                switch (countArrayInputNumber)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    arrayDataCount[1] = 0;//保存在数组中
                    arrayStop = 1;
                    QStringList list;
                    flashingStr[4] = QString("剖面数：%1").arg(arrayDataCount[0]*10+arrayDataCount[1]);
                    list<<flashingStr[0]
                            <<flashingStr[1]
                            <<flashingStr[2]
                            <<flashingStr[3]
                            <<flashingStr[4]
                            <<flashingStr[5];
                    showTableWidgetStrList(list);
                    countArrayInputNumber++;
                    dotPitch = arrayDataCount[0]*10+arrayDataCount[1];
                    break;
                }
                }
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 8;
                nBtnNumber1 = 13;
                nBtnNumber2 = 13;
                nBtnNumber3 = 12;
                nBtnNumber4 = 11;
                nBtnNumber5 = 10;
                nBtnNumber6 = 9;
                nBtnNumber7 = 9;
                nBtnNumber8 = 9;
                nBtnNumber9 = 9;
                nBtnOK = 12;
                nBtnQuit = 8;
                break;
            }      
            case 9://测量参数-第一个参数：实接电极数
            {
//                qDebug()<<2;
                switch (countMeasureInput)
                {
                case 1://0是第一个数
                {

                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    measureSaveData[1] = 0;//保存在数组中
                    measureStop = 1;
                    QStringList list;
                    measureInputString[1] = QString("实接电极数：%1").arg(measureSaveData[0]*10+measureSaveData[1]);
                    list<<measureInputString[0]
                            <<measureInputString[1]
                            <<measureInputString[2]
                            <<measureInputString[3]
                            <<measureInputString[4]
                            <<measureInputString[5];
                    showTableWidgetStrList(list);
                    countMeasureInput++;
                    measureSaveDataAll[0] = measureSaveData[0]*10+measureSaveData[1];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 9;
                nBtnNumber1 = 14;
                nBtnNumber2 = 14;
                nBtnNumber3 = 13;
                nBtnNumber4 = 12;
                nBtnNumber5 = 11;
                nBtnNumber6 = 10;
                nBtnNumber7 = 10;
                nBtnNumber8 = 10;
                nBtnNumber9 = 10;
                nBtnOK = 13;
                nBtnQuit = 9;
                break;
            }
            case 10://测量参数-第二个参数：电极号
            {
//                qDebug()<<2;
                switch (countMeasureInput)
                {
                case 1://0是第一个数
                {

                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    measureSaveData[1] = 0;//保存在数组中
                    measureStop = 1;
                    QStringList list;
                    measureInputString[2] = QString("输入电极号：%1").arg(measureSaveData[0]*10+measureSaveData[1]);
                    list<<measureInputString[0]
                            <<measureInputString[1]
                            <<measureInputString[2]
                            <<measureInputString[3]
                            <<measureInputString[4]
                            <<measureInputString[5];
                    showTableWidgetStrList(list);
                    countMeasureInput++;
                    measureSaveDataAll[1] = measureSaveData[0]*10+measureSaveData[1];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 10;
                nBtnNumber1 = 15;
                nBtnNumber2 = 15;
                nBtnNumber3 = 14;
                nBtnNumber4 = 13;
                nBtnNumber5 = 12;
                nBtnNumber6 = 11;
                nBtnNumber7 = 11;
                nBtnNumber8 = 11;
                nBtnNumber9 = 11;
                nBtnOK = 14;
                nBtnQuit = 10;
                break;
            }
            case 11://高密度方式-设置供电时间
            {
//                qDebug()<<2;
                switch (highDensityCount)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    highDensityData[1] = 0;//保存在数组中
                    sleepStop = 1;
                    QStringList list;
                    QString strTemp = QString("供电时间:%1").arg(highDensityData[0]*10+highDensityData[1]);
                    showTableWidgetStr(strTemp);
                    highDensityCount++;
                    highDensityDataAll = highDensityData[0]*10+highDensityData[1];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 11;
                nBtnNumber1 = 16;
                nBtnNumber2 = 16;
                nBtnNumber3 = 15;
                nBtnNumber4 = 14;
                nBtnNumber5 = 13;
                nBtnNumber6 = 12;
                nBtnNumber7 = 12;
                nBtnNumber8 = 12;
                nBtnNumber9 = 12;
                nBtnOK = 16;
                nBtnQuit = 11;
                break;
            }
            case 12://显示剖面曲线-输入断面号
            {
                switch (profileCurveCount)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    profileCurveData[1] = 0;//保存在数组中
                    profileCurveStop = 1;
                    QStringList list;
                    QString strTemp = QString("输入断面号：_%1").arg(profileCurveData[0]*10+profileCurveData[1]);
                    list<<"显示剖面曲线"
                    <<strTemp
                    <<"输入剖面号：___"
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    profileCurveCount++;
                    profileCurveDataAll[0] = profileCurveData[0]*10+profileCurveData[1];
                    break;
                }
                case 3://0是第三个数
                {
                    profileCurveData[2] = 0;//保存在数组中
                    profileCurveStop = 1;
                    QStringList list;
                    QString strTemp = QString("输入断面号：%1").arg(profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2]);
                    list<<"显示剖面曲线"
                    <<strTemp
                    <<"输入剖面号：___"
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    profileCurveCount++;
                    profileCurveDataAll[0] = profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 12;
                nBtnNumber1 = 17;
                nBtnNumber2 = 17;
                nBtnNumber3 = 16;
                nBtnNumber4 = 15;
                nBtnNumber5 = 15;
                nBtnNumber6 = 13;
                nBtnNumber7 = 13;
                nBtnNumber8 = 13;
                nBtnNumber9 = 13;
                nBtnOK = 17;
                nBtnQuit = 12;
                break;
            }
            case 13://显示剖面曲线-输入断面号
            {
                switch (profileCurveCount)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    profileCurveData[1] = 0;//保存在数组中
                    profileCurveStop = 1;
                    QStringList list;
                    QString strTemp1 = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
                    QString strTemp2 = QString("输入剖面号：_%1").arg(profileCurveData[0]*10+profileCurveData[1]);
                    list<<"显示剖面曲线"
                    <<strTemp1
                    <<strTemp2
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    profileCurveCount++;
                    profileCurveDataAll[1] = profileCurveData[0]*10+profileCurveData[1];
                    break;
                }
                case 3://0是第三个数
                {
                    profileCurveData[2] = 0;//保存在数组中
                    profileCurveStop = 1;
                    QStringList list;
                    QString strTemp1 = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
                    QString strTemp2 = QString("输入剖面号：%1").arg(profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2]);
                    list<<"显示剖面曲线"
                    <<strTemp1
                    <<strTemp2
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    profileCurveCount++;
                    profileCurveDataAll[1] = profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 13;
                nBtnNumber1 = 18;
                nBtnNumber2 = 18;
                nBtnNumber3 = 17;
                nBtnNumber4 = 16;
                nBtnNumber5 = 16;
                nBtnNumber6 = 14;
                nBtnNumber7 = 14;
                nBtnNumber8 = 14;
                nBtnNumber9 = 14;
                nBtnOK = 18;
                nBtnQuit = 13;
                break;
            }


                //////
            case 14://显示断面曲线-输入剖面号
            {
                switch (sectionCurveCount)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    sectionCurveData[1] = 0;//保存在数组中
                    sectionCurveStop = 1;
                    QStringList list;
                    QString strTemp = QString("输入断面号：_%1").arg(sectionCurveData[0]*10+sectionCurveData[1]);
                    list<<"显示断面曲线"
                    <<strTemp
                    <<"输入剖面号：___"
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    sectionCurveCount++;
                    sectionCurveDataAll[0] = sectionCurveData[0]*10+sectionCurveData[1];
                    break;
                }
                case 3://0是第三个数
                {
                    sectionCurveData[2] = 0;//保存在数组中
                    sectionCurveStop = 1;
                    QStringList list;
                    QString strTemp = QString("输入断面号：%1").arg(sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2]);
                    list<<"显示断面曲线"
                    <<strTemp
                    <<"输入剖面号：___"
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    sectionCurveCount++;
                    sectionCurveDataAll[0] = sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 14;
                nBtnNumber1 = 19;
                nBtnNumber2 = 19;
                nBtnNumber3 = 18;
                nBtnNumber4 = 18;
                nBtnNumber5 = 18;
                nBtnNumber6 = 17;
                nBtnNumber7 = 15;
                nBtnNumber8 = 16;
                nBtnNumber9 = 15;
                nBtnOK = 20;
                nBtnQuit = 15;
                break;
            }
            case 15://显示断面曲线-输入剖面号
            {
                switch (sectionCurveCount)
                {
                case 1://0是第一个数
                {
                    break;//不作处理
                }
                case 2://0是第二个数
                {
                    sectionCurveData[1] = 0;//保存在数组中
                    sectionCurveStop = 1;
                    QStringList list;
                    QString strTemp1 = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
                    QString strTemp2 = QString("输入剖面号：_%1").arg(sectionCurveData[0]*10+sectionCurveData[1]);
                    list<<"显示剖面曲线"
                    <<strTemp1
                    <<strTemp2
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    sectionCurveCount++;
                    sectionCurveDataAll[1] = sectionCurveData[0]*10+sectionCurveData[1];
                    break;
                }
                case 3://0是第三个数
                {
                    sectionCurveData[2] = 0;//保存在数组中
                    sectionCurveStop = 1;
                    QStringList list;
                    QString strTemp1 = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
                    QString strTemp2 = QString("输入剖面号：%1").arg(sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2]);
                    list<<"显示剖面曲线"
                    <<strTemp1
                    <<strTemp2
                    <<"确认─执行操作"
                    <<"退出─取消操作";
                    showTableWidgetStrList(list);
                    sectionCurveCount++;
                    sectionCurveDataAll[1] = sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2];
                    break;
                }
                }
                //数字键、确认、退出可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 15;
                nBtnNumber1 = 20;
                nBtnNumber2 = 20;
                nBtnNumber3 = 19;
                nBtnNumber4 = 19;
                nBtnNumber5 = 19;
                nBtnNumber6 = 18;
                nBtnNumber7 = 16;
                nBtnNumber8 = 17;
                nBtnNumber9 = 16;
                nBtnOK = 21;
                nBtnQuit = 16;
                break;
            }
            }
        }
    });

    //按钮1
    connect(ui->btn1,&QPushButton::clicked,[=](){
        if(state[10] == 1)
        {
            switch (nBtnNumber1)
            {
            case 1://测量-接地电阻界面
            {
                QStringList list;
                list<<"接地端电极为M";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                nBtnOK = 1;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }

            case 2://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_1_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 3://主菜单-设置工作参数
            {
                parameterSetting();
                break;
            }
            case 4://选功能界面
            {
                if(state[10] == 1)//确保点击1可用
                {
//                    ui->tableWidget->selectRow(2);
                    QMessageBox::information(this,"提示","你选择的是1","_请按确认到菜单_");
                    //emit measureMenu();
                    //只有确认键可用
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    nBtnOK = 19;

                }

                break;
            }
            case 5://参数设置界面输入第一个数字
            {
                setSamePart1(1);
                break;
            }
            case 6://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(1);
                break;
            }
            case 7://测量界面点1-剖面（连滚）
            {
                measureMethod();
                qDebug()<<"?";
                //数字键、确认、退出可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态
                nBtnNumber0 = 4;
                nBtnNumber1 = 8;
                nBtnNumber2 = 8;
                nBtnNumber3 = 7;
                nBtnNumber4 = 6;
                nBtnNumber5 = 5;
                nBtnNumber6 = 4;
                nBtnNumber7 = 4;
                nBtnNumber8 = 4;
                nBtnNumber9 = 4;
                nBtnOK = 6;
                nBtnQuit = 4;
                break;
            }

                ////
            case 8://测量参数设置-设置参数界面-输入1
            {
             measureMethodSamePart1(1);
             break;
            }
            case 9://测量参数设置-设置参数界面-输入1-输入第二个参数剖面号
            {

                measureMethodSamePart2(1);
                break;
            }
            case 10://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 1;
                QStringList list;
                flashingStr[1] = QString("滚动总数:1");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
                ////
            case 11://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(1);
                break;
            }
            case 12://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(1);
                break;
            }
            case 13://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(1);
                break;
            }
            case 14://测量-输入实接电极数
            {
                measureInputFirstNumber(1);
                break;
            }
            case 15://测量-输入电极号
            {
//                qDebug()<<"?";
                measureInputSecondNumber(1);
                break;
            }
            case 16://高密度测量方式-设置供电时间
            {
//                qDebug()<<"??";
                highDensityPowerSupplyTime(1);
                break;
            }
            case 17://显示剖面曲线-设置断面号
            {
                profileCurveInputData(1);
                break;
            }
            case 18://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(1);
                break;
            }
            case 19://显示断面曲线-设置断面号
            {
                sectionCurveInputData(1);
                break;
            }
            case 20://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(1);
                break;
            }
            }
        }

    });

    //按钮“2”被点击
    connect(ui->btn2,&QPushButton::clicked,[=](){
        if(state[11] == 1)
        {
            switch(nBtnNumber2)
            {
            case 1://点击功能按钮后
            {
                if(forChoose == true)//确保点击2使用来选择功能的
                {
                    ui->tableWidget->selectRow(2);
    //                qDebug()<<"菜单";
                    QMessageBox::information(this,"提示","你选择的是2","_请按确认到菜单_");
                    //emit measureMenu();
                    //只有确认键可用
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    nBtnOK = 19;
                }
                break;
            }
            case 2://点击2后达到测量界面
            {
                int temp = 1;
                if(highDensity == 1)//如果选择的是高密度测量方式
                {
                    while(sleepStop == 0)
                    {
//                        qDebug()<<"?";
                        if(temp == 1)
                        {
                            showTableWidgetStr("供电时间:5_");
                            sleepQt(500);
                            temp = -temp;
                        }
                        else
                        {
                            showTableWidgetStr("供电时间:5 ");
                            sleepQt(500);
                            temp = -temp;
                        }
                        //数字键、确认键、退出键可用
                        state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                        state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                        state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                        state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                        state[16] = 0;state[17] = 1;

                        //对应按键状态
                        nBtnNumber0 = 11;
                        nBtnNumber1 = 16;
                        nBtnNumber2 = 16;
                        nBtnNumber3 = 15;
                        nBtnNumber4 = 14;
                        nBtnNumber5 = 13;
                        nBtnNumber6 = 12;
                        nBtnNumber7 = 12;
                        nBtnNumber8 = 12;
                        nBtnNumber9 = 12;
                        nBtnOK = 16;
                        nBtnQuit = 11;
                    }
                    if(sleepStop == 1)
                    {
                        nBtnNumber1 = 7;
                        nBtnNumber2 = 7;
                        nBtnNumber3 = 2;//测量主机电池电压，测量-电池电压
                        nBtnNumber4 = 1;
                        nBtnNumber5 = 1;
                    }
                }
                else
                {
                    emit measureMenu();
//                    nBtnNumber2 = 3;//点击2后达到测量界面
                    //                qDebug()<<nBtnNumber;

                    //                qDebug()<<nBtnNumber5;
                    //此时在测量界面
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 0;

                    nBtnNumber1 = 7;
                    nBtnNumber2 = 7;
                    nBtnNumber3 = 2;//测量主机电池电压，测量-电池电压
                    nBtnNumber4 = 1;
                    nBtnNumber5 = 1;
                }
                break;
            }
                //测量-接地电阻界面
            case 3:
            {
                QStringList list;
                list<<"接地端电极为B";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                nBtnOK = 1;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 4://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_2_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 5://参数设置界面输入数字
            {
                setSamePart1(2);
                break;
            }
            case 6://参数设置界面输入第二个参数-剖面号
            {
               setSamePart2(2);
                break;
            }  
            case 7://测量界面点2-断面（连滚）
            {
               measureMethod();
               //数字键、确认、退出可用了
               state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
               state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
               state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
               state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
               state[16] = 0;state[17] = 1;

               //对应按键状态
               nBtnNumber0 = 4;
               nBtnNumber1 = 8;
               nBtnNumber2 = 8;
               nBtnNumber3 = 7;
               nBtnNumber4 = 6;
               nBtnNumber5 = 5;
               nBtnNumber6 = 4;
               nBtnNumber7 = 4;
               nBtnNumber8 = 4;
               nBtnNumber9 = 4;
               nBtnOK = 6;
               nBtnQuit = 4;
               break;
            }
                ////
            case 8://测量参数设置-设置参数界面-输入2
            {
                measureMethodSamePart1(2);
                break;
            }
            case 9://测量参数设置-设置参数界面-输入1-输入第二个参数剖面号
            {
//                qDebug()<<2;
                measureMethodSamePart2(2);
                break;
            }
            case 10://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 2;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:2");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 11://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(2);
                break;
            }
            case 12://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(2);
                break;
            }
            case 13://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(2);
                break;
            }
            case 14:
            {
                measureInputFirstNumber(2);
                break;
            }
            case 15://测量-输入电极号
            {
                measureInputSecondNumber(2);
                break;
            }
            case 16://高密度测量方式-设置供电时间
            {
//                qDebug()<<"??";
                highDensityPowerSupplyTime(2);
                break;
            }
            case 17://显示剖面曲线-设置断面号
            {
                profileCurveInputData(2);
                break;
            }
            case 18://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(2);
                break;
            }
            case 19://显示断面曲线-设置断面号
            {
                sectionCurveInputData(2);
                break;
            }
            case 20://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(2);
                break;
            }
            }


        }
    });


    //按钮3
    connect(ui->btn3,&QPushButton::clicked,[=](){
        if(state[12] == 1)
        {
            switch (nBtnNumber3)
            {
            case 1://测量-接地电阻界面
            {
                QStringList list;
                list<<"接地端电极为A";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                nBtnOK = 1;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 2:
            {
                QStringList list;
                list<<"正在测量"
                      <<"_请等待_";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                QTimer *timer = new QTimer(this);
                timer->start(2500);

                connect(timer,&QTimer::timeout,[=](){
//                    //产生随机数
//                    QTime time;
//                    time= QTime::currentTime();
//                    qsrand(time.msec()+time.second()*1000);
//                    int n = qrand() % 20000; //产生5以内的随机数
//                    double x = n * 1.156;
                    x = randNumber(2000);
                    count = count + 1;

                    if(count == 1)
                    {

                        if(x<9600)
                        {
                            ui->tableWidget->setRowCount(1);
                            QTableWidgetItem * item = new QTableWidgetItem("电量过低!!!");
                            ui->tableWidget->setItem(0,0,item);
                            ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                            //this->addItem(file.at(i));
                        }
                        else
                        {
                            QString str = QString("电池电压= %1 mv").arg(x);
                            ui->tableWidget->setRowCount(1);
                            QTableWidgetItem * item = new QTableWidgetItem(str);
                            ui->tableWidget->setItem(0,0,item);
                            ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                            //this->addItem(file.at(i));
                        }


                    }
                    if(count == 2)
                        {
                        emit measureMenu();
                        nBtnNumber3 = 2;
                    }
                    if(count>=3)
                    {
                    timer->stop();
                    count = 0;
                    }
                });

                break;
            }
            case 3://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_3_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 4://选功能界面
            {
                if(state[12] == 1)//确保按钮3可用
                {
//                    ui->tableWidget->selectRow(2);
    //                qDebug()<<"菜单";
                    QMessageBox::information(this,"提示","你选择的是3","_请按确认到菜单_");
                    //emit measureMenu();
                    highDensity = 1;//高密度测量方式
                    //只有确认键可用
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    nBtnOK = 19;
                }

                break;
            }
            case 5://参数设置界面输入数字
            {
                setSamePart1(3);
                break;
            }
            case 6://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(3);
                break;
            }
            case 7://测量模式-滚动-输入第一个剖面参数
            {
                measureMethodSamePart1(3);
                break;
            }
            case 8://测量模式-滚动-输入第二个剖面参数
            {
                measureMethodSamePart2(3);
                break;
            }
            case 9://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 3;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:3");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 10://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(3);
                break;
            }
            case 11://设置点距-输入3
            {
//                qDebug()<<2;

                arrayDotPitch(3);
                break;
            }
            case 12://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(3);
                break;
            }
            case 13:
            {
                measureInputFirstNumber(3);
                break;
            }
            case 14://测量-输入电极号
            {
                measureInputSecondNumber(3);
                break;
            }
            case 15://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(3);
                break;
            }
            case 16://显示剖面曲线-设置断面号
            {
                profileCurveInputData(3);
                break;
            }
            case 17://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(3);
                break;
            }
            case 18://显示断面曲线-设置断面号
            {
                sectionCurveInputData(3);
                break;
            }
            case 19://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(3);
                break;
            }
            }
            }
    });

    //按钮4
    connect(ui->btn4,&QPushButton::clicked,[=](){

        if(state[6] == 1)
        {
            switch (nBtnNumber4)
            {
            case 1://测量界面-点4-电极箱电压
            {
                ui->tableWidget->setRowCount(1);
                QTableWidgetItem * item = new QTableWidgetItem("请输入电极箱编号:___");
                ui->tableWidget->setItem(0,0,item);
                ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                //this->addItem(file.at(i));
                //数字1~9都可以用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 0;

                nBtnNumber1 = 2;
                nBtnNumber2 = 4;
                nBtnNumber3 = 3;
                nBtnNumber4 = 2;
                nBtnNumber5 = 2;
                nBtnNumber6 = 1;
                nBtnNumber7 = 1;
                nBtnNumber8 = 1;
                nBtnNumber9 = 1;

                break;
            }
            case 2://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_4_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 3://选功能界面
            {
                if(state[6] == 1)//确保按钮4可用
                {
//                    ui->tableWidget->selectRow(2);
    //                qDebug()<<"菜单";
                    QMessageBox::information(this,"提示","你选择的是4","_请按确认到菜单_");
                    //emit measureMenu();
                    highDensity = 1;//高密度测量方式

                    //只有确认键可用
                    state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                    state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                    state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    nBtnOK = 19;
                }

                break;
            }
            case 4://参数设置界面输入数字
            {
                setSamePart1(4);
                break;
            }
            case 5://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(4);
                break;
            }
            case 6://测量-输入起始剖面参数
            {
                measureMethodSamePart1(4);
                break;
            }
            case 7://测量-输入终止剖面参数
            {
                measureMethodSamePart2(4);
                break;
            }

            case 8://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 4;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:4");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 9://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(4);
                break;
            }
            case 10://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(4);
                break;
            }
            case 11://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(4);
                break;
            }
            case 12:
            {
                measureInputFirstNumber(4);
                break;
            }
            case 13://测量-输入电极号
            {
                measureInputSecondNumber(4);
                break;
            }
            case 14://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(4);
                break;
            }
            case 15://显示剖面曲线-设置断面号
            {
                profileCurveInputData(4);
                break;
            }
            case 16://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(4);
                break;
            }
            case 17://显示剖面曲线-点击4/<-移动
            {
                if(position > 0 && position < 20)
                {
                    plot->detachItems();//擦除重绘
                    position --;
                    points2.clear();
                    points2<<pointTemp.at(position);//<<QPointF(pointTemp.at(position).x(),100.);
                    plot->paintPlot(pointTemp,points2);

                    QStringList list;
                    QString str1 = QString("Ro=%1 NL=100").arg(points1.at(position).y());
                    QString str2 = QString("ND= %1").arg(points1.at(position).x());
                    list<<str1
                            <<str2;
                    showTableWidgetStrList(list);
                    plot->setParent(this);
                    plot->initialization(0.,22.,150.,330.);
//                    plot->paintPlot(points1,points2);
    //                QwtPlotMarker *maker = new QwtPlotMarker;
                    plot->setGeometry(30,180,351,191);
                    plot->show();

                    //只有4、5、6、8、±、·、退出键可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                    state[16] = 1;state[17] = 0;

                    nBtnQuit = 1;
                    nBtnPlus = 2;
                    nBtnPoint = 2;
                    nBtnNumber4 = 17;
                    nBtnNumber5 = 17;
                    nBtnNumber6 = 15;
                    nBtnNumber8 = 15;
                }

                break;
            }
            case 18://显示断面曲线-设置断面号
            {
                sectionCurveInputData(4);
                break;
            }
            case 19://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(4);
                break;
            }
            }
        }
    });
    //按钮5被点击
    connect(ui->btn5,&QPushButton::clicked,[=](){

        if(state[7] == 1)
        {
            switch (nBtnNumber5)
            {
            case 1://点击5查看接地电阻
            {
                QStringList list;
                list<<"0-N,1-M,2-B,3-A"
                      <<"Bno......."
                      <<"选择接地电极(编号0~3)";
                for(int i=0;i<list.size();i++)
                {
                    ui->tableWidget->setRowCount(i+1);
                    QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
                    ui->tableWidget->setItem(i,0,item);
                    ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
                    //this->addItem(file.at(i));
                }
                //此时选择接地端界面
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 1;state[15] = 0;
                state[16] = 0;state[17] = 0;
                //表示0~3按键可用
                nBtnNumber0 = 1;
                nBtnNumber1 = 1;
                nBtnNumber2 = 3;
                nBtnNumber3 = 1;
                break;
            }
            case 2://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_5_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 3://参数设置界面输入数字
            {
                setSamePart1(5);
                break;
            }
            case 4://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(5);
                break;
            }
            case 5://测量-输入起始剖面参数
            {
                measureMethodSamePart1(5);
                break;
            }
            case 6://测量-输入终止剖面参数
            {
                measureMethodSamePart2(5);
                break;
            }

            case 7://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 5;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:5");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 8://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(5);
                break;
            }
            case 9://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(5);
                break;
            }
            case 10://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(5);
                break;
            }
            case 11:
            {
                measureInputFirstNumber(5);
                break;
            }
            case 12://测量-输入电极号
            {
                measureInputSecondNumber(5);
                break;
            }
            case 13://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(5);
                break;
            }
            case 14://输入断面号和剖面号
            {
                int temp = 1;
                QStringList list;
                while(profileCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示剖面曲线"
                        <<"输入断面号：___"
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示剖面曲线"
                        <<"输入断面号：   "
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 12;
                    nBtnNumber1 = 17;
                    nBtnNumber2 = 17;
                    nBtnNumber3 = 16;
                    nBtnNumber4 = 15;
                    nBtnNumber5 = 15;
                    nBtnNumber6 = 13;
                    nBtnNumber7 = 13;
                    nBtnNumber8 = 13;
                    nBtnNumber9 = 13;
                    nBtnOK = 17;
                    nBtnQuit = 12;
                }
                break;
            }
            case 15://显示剖面曲线-设置断面号
            {
                profileCurveInputData(5);
                break;
            }
            case 16://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(5);
                break;
            }
            case 17://显示剖面曲线-点击5/↓平移曲线
            {
                plot->detachItems();//擦除重绘

                for(int i = 0;i < 20;i ++)
                {
                    double y =pointTemp[i].y();
                    y = y - 5.0;
                    pointTemp[i].setY(y);
                }
                yTemp = yTemp - 5.0;
                points2.clear();
                points2<<pointTemp.at(position);//<<QPointF(pointTemp.at(position).x(),yTemp);
                plot->paintPlot(pointTemp,points2);

                QStringList list;
                QString str1 = QString("Ro=%1 NL=100").arg(points1.at(position).y());
                QString str2 = QString("ND= %1").arg(points1.at(position).x());
                list<<str1
                        <<str2;
                showTableWidgetStrList(list);
                plot->setParent(this);
                plot->initialization(0.,22.,150.,320.);
                plot->paintPlot(pointTemp,points2);
                plot->setGeometry(30,180,351,191);
                plot->show();

                //只有4、5、6、8、±、·、退出键可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 0;

                nBtnQuit = 1;
                nBtnPlus = 2;
                nBtnPoint = 2;
                nBtnNumber4 = 17;
                nBtnNumber5 = 17;
                nBtnNumber6 = 15;
                nBtnNumber8 = 15;
                break;

            }
            case 18://显示断面曲线-设置断面号
            {
                sectionCurveInputData(5);
                break;
            }
            case 19://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(5);
                break;
            }
            }
        }

    });

    //按钮6
    connect(ui->btn6,&QPushButton::clicked,[=](){

        if(state[8] == 1)
        {
            switch (nBtnNumber6)
            {
            case 1://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_6_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 2://参数设置界面输入数字
            {
                setSamePart1(6);
                break;
            }
            case 3://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(6);
                break;
            }
            case 4://测量-输入起始剖面参数
            {
                measureMethodSamePart1(6);
                break;
            }
            case 5://测量-输入终止剖面参数
            {
                measureMethodSamePart2(6);
                break;
            }
            case 6://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 6;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:6");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 7://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(6);
                break;
            }
            case 8://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(6);
                break;
            }
            case 9://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(6);
                break;
            }
            case 10:
            {
                measureInputFirstNumber(6);
                break;
            }
            case 11://测量-输入电极号
            {
                measureInputSecondNumber(6);
                break;
            }
            case 12://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(6);
                break;
            }
            case 13://显示剖面曲线-设置断面号
            {
                profileCurveInputData(6);
                break;
            }
            case 14://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(6);
                break;
            }
            case 15://显示剖面曲线-点击6/->移动标记
            {

                if(position >= 0 && position < 19)
                {
                    plot->detachItems();//擦除重绘
                    position++;
                    points2.clear();
                    points2<<pointTemp.at(position);//<<QPointF(pointTemp.at(position).x(),100.);
                    plot->paintPlot(pointTemp,points2);

                    QStringList list;
                    QString str1 = QString("Ro=%1 NL=100").arg(points1.at(position).y());
                    QString str2 = QString("ND= %1").arg(points1.at(position).x());
                    list<<str1
                            <<str2;
                    showTableWidgetStrList(list);
                    plot->setParent(this);
                    plot->initialization(0.,22.,150.,330.);
//                    plot->paintPlot(points1,points2);
    //                QwtPlotMarker *maker = new QwtPlotMarker;
                    plot->setGeometry(30,180,351,191);
                    plot->show();

                    //只有4、5、6、8、±、·、退出键可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                    state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                    state[16] = 1;state[17] = 0;

                    nBtnQuit = 1;
                    nBtnPlus = 2;
                    nBtnPoint = 2;
                    nBtnNumber4 = 17;
                    nBtnNumber5 = 17;
                    nBtnNumber6 = 15;
                    nBtnNumber8 = 15;
                }
                break;
            }
            case 16://按6-显示断面
            {
                int temp = 1;
                QStringList list;
                while(sectionCurveStop == 0)
                {
                    if(temp == 1)
                    {
                        list<<"显示断面曲线"
                        <<"输入断面号：___"
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
                    else
                    {
                        list<<"显示断面曲线"
                        <<"输入断面号：   "
                        <<"输入剖面号：___"
                        <<"确认─执行操作"
                        <<"退出─取消操作";
                        temp = -temp;
                    }
//                    qDebug()<<list;
                    showTableWidgetStrList(list);
                    list.clear();
                    sleepQt(500);
                    //数字键、确认、退出可用
                    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
                    state[16] = 0;state[17] = 1;

                    //对应按键状态
                    nBtnNumber0 = 14;
                    nBtnNumber1 = 19;
                    nBtnNumber2 = 19;
                    nBtnNumber3 = 18;
                    nBtnNumber4 = 18;
                    nBtnNumber5 = 18;
                    nBtnNumber6 = 17;
                    nBtnNumber7 = 15;
                    nBtnNumber8 = 16;
                    nBtnNumber9 = 15;
                    nBtnOK = 20;
                    nBtnQuit = 15;
                }
                break;
            }
            case 17://显示断面曲线-设置断面号
            {
                sectionCurveInputData(6);
                break;
            }
            case 18://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(6);
                break;
            }
            }
        }

    });

    //按钮7
    connect(ui->btn7,&QPushButton::clicked,[=](){
        if(state[2] == 1)
        {
            switch (nBtnNumber7)
            {
            case 1://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_7_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 2://参数设置界面输入数字
            {
                setSamePart1(7);
                break;
            }
            case 3://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(7);
                break;
            }
            case 4://测量-输入起始剖面参数
            {
                measureMethodSamePart1(7);
                break;
            }
            case 5://测量-输入终止剖面参数
            {
                measureMethodSamePart2(7);
                break;
            }
            case 6://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 7;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:7");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 7://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(7);
                break;
            }
            case 8://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(7);
                break;
            }
            case 9://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(7);
                break;
            }
            case 10:
            {
                measureInputFirstNumber(7);
                break;
            }
            case 11://测量-输入电极号
            {
                measureInputSecondNumber(7);
                break;
            }
            case 12://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(7);
                break;
            }
            case 13://显示剖面曲线-设置断面号
            {
                profileCurveInputData(7);
                break;
            }
            case 14://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(7);
                break;
            }
            case 15://显示断面曲线-设置断面号
            {
                sectionCurveInputData(7);
                break;
            }
            case 16://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(7);
                break;
            }
            }
        }
    });

    //按钮8
    connect(ui->btn8,&QPushButton::clicked,[=](){
        if(state[3] == 1)
        {
            switch (nBtnNumber8)
            {
            case 1://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_8_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 2://参数设置界面输入数字
            {
                setSamePart1(8);
                break;
            }
            case 3://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(8);
                break;
            }
            case 4://测量-输入起始剖面参数
            {
                measureMethodSamePart1(8);
                break;
            }
            case 5://测量-输入终止剖面参数
            {
                measureMethodSamePart2(8);
                break;
            }
            case 6://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 8;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:8");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 7://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(8);
                break;
            }
            case 8://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(8);
                break;
            }
            case 9://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(8);
                break;
            }
            case 10:
            {
                measureInputFirstNumber(8);
                break;
            }
            case 11://测量-输入电极号
            {
                measureInputSecondNumber(8);
                break;
            }
            case 12://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(8);
                break;
            }
            case 13://显示剖面曲线-设置断面号
            {
                profileCurveInputData(8);
                break;
            }
            case 14://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(8);
                break;
            }
            case 15://显示剖面曲线-点击8/↑移动曲线
            {
                plot->detachItems();//擦除重绘

                for(int i = 0;i < 20;i ++)
                {
                    double y =pointTemp[i].y();
                    y = y + 5.0;
                    pointTemp[i].setY(y);
                }
                yTemp = yTemp - 5.0;
                points2.clear();
                points2<<pointTemp.at(position);//<<QPointF(pointTemp.at(position).x(),yTemp);
                plot->paintPlot(pointTemp,points2);

                QStringList list;
                QString str1 = QString("Ro=%1 NL=100").arg(points1.at(position).y());
                QString str2 = QString("ND= %1").arg(points1.at(position).x());
                list<<str1
                        <<str2;
                showTableWidgetStrList(list);
                plot->setParent(this);
                plot->initialization(0.,22.,150.,320.);
                plot->paintPlot(pointTemp,points2);
                plot->setGeometry(30,180,351,191);
                plot->show();

                //只有4、5、6、8、±、·、退出键可用
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 0;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 1;state[14] = 0;state[15] = 1;
                state[16] = 1;state[17] = 0;

                nBtnQuit = 1;
                nBtnPlus = 2;
                nBtnPoint = 2;
                nBtnNumber4 = 17;
                nBtnNumber5 = 17;
                nBtnNumber6 = 15;
                nBtnNumber8 = 15;
                break;
            }
            case 16://显示断面曲线-设置断面号
            {
                sectionCurveInputData(8);
                break;
            }
            case 17://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(8);
                break;
            }
            }
        }
    });

    //按钮9
    connect(ui->btn9,&QPushButton::clicked,[=](){
        if(state[4] == 1)
        {
            switch (nBtnNumber9)
            {
            case 1://电极箱电压测试界面
            {
                showTableWidgetStr("电极箱号：_9_");
                nBtnOK = 3;
                //此时只有确认键可用
                state[0] = 0;state[1] = 1;state[2] = 0;state[3] = 0;
                state[4] = 0;state[5] = 0;state[6] = 0;state[7] = 0;
                state[8] = 0;state[9] = 0;state[10] = 0;state[11] = 0;
                state[12] = 0;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;
                break;
            }
            case 2://参数设置界面输入数字
            {
                setSamePart1(9);
                break;
            }
            case 3://参数设置界面输入第二个参数-剖面号
            {
                setSamePart2(9);
                break;
            }
            case 4://测量-输入起始剖面参数
            {
                measureMethodSamePart1(9);
                break;
            }
            case 5://测量-输入终止剖面参数
            {
                measureMethodSamePart2(9);
                break;
            }
            case 6://输入滚动电极数
            {
                arrayStop = 1;
                arrayData[0] = 9;//保存数据
                QStringList list;
                flashingStr[1] = QString("滚动总数:9");
                list<<flashingStr[0]
                        <<flashingStr[1]
                        <<flashingStr[2]
                        <<flashingStr[3]
                        <<flashingStr[4]
                        <<flashingStr[5];
                showTableWidgetStrList(list);
                //数字键、确认可用了
                state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
                state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
                state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
                state[12] = 1;state[13] = 0;state[14] = 0;state[15] = 0;
                state[16] = 0;state[17] = 1;

                //对应按键状态

                nBtnNumber1 = 10;
                nBtnNumber2 = 10;
                nBtnNumber3 = 9;
                nBtnNumber4 = 8;
                nBtnNumber5 = 7;
                nBtnNumber6 = 6;
                nBtnNumber7 = 6;
                nBtnNumber8 = 6;
                nBtnNumber9 = 6;
                nBtnOK = 9;
                break;
            }
            case 7://设置使用电极数-输入1
            {
//                qDebug()<<2;
                arrayElectrode(9);
                break;
            }
            case 8://设置点距-输入1
            {
//                qDebug()<<2;

                arrayDotPitch(9);
                break;
            }
            case 9://设置点距-输入1
            {
//                qDebug()<<2;

                arraySectionNumber(9);
                break;
            }
            case 10:
            {
                measureInputFirstNumber(9);
                break;
            }
            case 11://测量-输入电极号
            {
                measureInputSecondNumber(9);
                break;
            }
            case 12://高密度测量方式-设置供电时间
            {
                highDensityPowerSupplyTime(9);
                break;
            }
            case 13://显示剖面曲线-设置断面号
            {
                profileCurveInputData(9);
                break;
            }
            case 14://显示剖面曲线-设置剖面号
            {
                profileCurveInputSecondData(9);
                break;
            }
            case 15://显示断面曲线-设置断面号
            {
                sectionCurveInputData(9);
                break;
            }
            case 16://显示断面曲线-设置剖面号
            {
                sectionCurveInputSecondData(9);
                break;
            }
            }
        }
    });
}

//自定义槽open()
void operationWindow::Open()
{
    QStringList list;
    list<<"WGMD-3"
          <<"_高密度_"
          <<"电阻率测量系统Ⅱ"
          <<"2014.3"
          <<"Tel:86-023-68607324"
          <<"_重庆_"
          <<"_奔腾数控技术研究所制_";
    for(int i=0;i<list.size();i++)
    {
        ui->tableWidget->setRowCount(i+1);
        QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
        ui->tableWidget->setItem(i,0,item);
        ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
        //this->addItem(file.at(i));
    }
}

void operationWindow::functionMenu()
{
    QStringList list;
    list<<"测量功能选择:"
          <<"_1.电阻率与激电_ "
          <<"2.电阻率与自电"
          <<"3.高密度电阻率1"
          <<"4.高密度电阻率2";
    for(int i=0;i<list.size();i++)
    {
        ui->tableWidget->setRowCount(i+1);
        QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
        ui->tableWidget->setItem(i,0,item);
        ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
        //this->addItem(file.at(i));
    }
}

void operationWindow::showMenu()
{
    QStringList list;
    list<<"1.设置工作参数"
          <<"2.测量"
          <<"3．断面表"
          <<"4．断面参数表"
          <<"5.显示剖面"
          <<"6.显示断面"
          <<"7.RS-232通讯"
          <<"8.硬件测试";
    for(int i=0;i<list.size();i++)
    {
        ui->tableWidget->setRowCount(i+1);
        QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
        ui->tableWidget->setItem(i,0,item);
        ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
        //this->addItem(file.at(i));
    }
}

void operationWindow::measureMenu()
{
    QStringList list;
    list<<"1. 剖面(单滚)"
          <<"2. 断面(连滚)"
          <<"3. 电池电压"
          <<"4. _电极箱电池_"
          <<"5. 接地电阻"
          <<"6. 断面收尾";
    for(int i=0;i<list.size();i++)
    {
        ui->tableWidget->setRowCount(i+1);
        QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
        ui->tableWidget->setItem(i,0,item);
        ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
        //this->addItem(file.at(i));
    }
}
operationWindow::~operationWindow()
{
    delete ui;
}

double operationWindow::randNumber(int n)
{
    //产生随机数
    QTime time;
    time= QTime::currentTime();
//    qsrand(time.msec()+time.second()*1000);
    int m = qrand() % n; //产生5以内的随机数
    double x = m * 1.156;
    return x;
}

void operationWindow::showTableWidgetStr(QString str)
{

        ui->tableWidget->setRowCount(1);
        QTableWidgetItem * item = new QTableWidgetItem(str);
        ui->tableWidget->setItem(0,0,item);
        ui->tableWidget->item(0,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
        //this->addItem(file.at(i));
}

void operationWindow::showTableWidgetStrList(QStringList list)
{
    for(int i=0;i<list.size();i++)
    {
        ui->tableWidget->setRowCount(i+1);
        QTableWidgetItem * item = new QTableWidgetItem(list.at(i));
        ui->tableWidget->setItem(i,0,item);
        ui->tableWidget->item(i,0)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);//设置文字居中
        //this->addItem(file.at(i));
    }
}

void operationWindow::parameterSetting()
{
    QTimer *timer = new QTimer(this);
    timer->start(500);

    connect(timer,&QTimer::timeout,[=](){
        QStringList list;
        if(timerStop == 1)
        {
            timer->stop();

        }
        else
        {
            if(loop == true)
            {
                list.clear();
                list<<"选择工作断面"
                      <<"输入断面号：___"
                      <<"输入剖面号：___"
                      <<"确认─执行操作"
                      <<"退出─取消操作";
                loop = false;
            }
            else
            {
                list.clear();
                list<<"选择工作断面"
                      <<"输入断面号：   "
                      <<"输入剖面号：___"
                      <<"确认─执行操作"
                      <<"退出─取消操作";
                loop = true;
            }
//                    qDebug()<<loop;
            showTableWidgetStrList(list);

        }
    });
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 2;
    nBtnNumber1 = 5;
    nBtnNumber2 = 5;
    nBtnNumber3 = 5;
    nBtnNumber4 = 4;
    nBtnNumber5 = 3;
    nBtnNumber6 = 2;
    nBtnNumber7 = 2;
    nBtnNumber8 = 2;
    nBtnNumber9 = 2;
    nBtnOK = 4;
    nBtnQuit = 2;
}

void operationWindow::parameterSettingAfterOK()
{
    QTimer *timer = new QTimer(this);
    timer->start(500);
    QString str;
    if((saveData/100) >= 1)//三位数
    {
        str = QString("输入断面号：%1").arg(saveData);
    }
    else
    {
        if((saveData/10) > 1)//二位数
        {

            str = QString("输入断面号：_%1").arg(saveData);
        }
        else  //一位数
        {
            str = QString("输入断面号：__%1").arg(saveData);
        }
    }
    connect(timer,&QTimer::timeout,[=](){
        QStringList list;
        if(timerStop2 == 1)
        {
            timer->stop();

        }
        else
        {
            if(loop == true)
            {
                list.clear();
                list<<"选择工作断面"
                      <<str
                      <<"输入剖面号：___"
                      <<"确认─执行操作"
                      <<"退出─取消操作";
                loop = false;
            }
            else
            {
                list.clear();
                list<<"选择工作断面"
                      <<str
                      <<"输入剖面号：   "
                      <<"确认─执行操作"
                      <<"退出─取消操作";
                loop = true;
            }
//                    qDebug()<<loop;
            showTableWidgetStrList(list);

        }
    });
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 3;
    nBtnNumber1 = 6;
    nBtnNumber2 = 6;
    nBtnNumber3 = 6;
    nBtnNumber4 = 5;
    nBtnNumber5 = 4;
    nBtnNumber6 = 3;
    nBtnNumber7 = 3;
    nBtnNumber8 = 3;
    nBtnNumber9 = 3;
    nBtnOK = 5;
    nBtnQuit = 3;
}

void operationWindow::measureMethod()
{
    QTimer *timer = new QTimer(this);
    timer->start(500);
    QString str;

    if((saveDataMeasure/100) > 1)//三位数
        str = QString("起始剖面号：%1").arg(saveDataMeasure);
    else
    {
        if((saveDataMeasure/10) > 1)//二位数
            str = QString("起始剖面号：_%1").arg(saveDataMeasure);
        else  //一位数
            str = QString("起始剖面号：：__%1").arg(saveDataMeasure);
    }
    connect(timer,&QTimer::timeout,[=](){
        QStringList list;
        if(timerStopMeasure == 1)
        {
            timer->stop();

        }
        else
        {
            if(loop == true)
            {
                list.clear();
                list<<"输入起始剖面号：___"
                    <<"输入结束剖面号：___";
                loop = false;
            }
            else
            {
                list.clear();
                list<<"输入起始剖面号：   "
                    <<"输入结束剖面号：___";
                loop = true;
            }
//                    qDebug()<<loop;
            showTableWidgetStrList(list);

        }
    });
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

//    //对应按键状态
//    nBtnNumber0 = 3;
//    nBtnNumber1 = 6;
//    nBtnNumber2 = 6;
//    nBtnNumber3 = 6;
//    nBtnNumber4 = 5;
//    nBtnNumber5 = 4;
//    nBtnNumber6 = 3;
//    nBtnNumber7 = 3;
//    nBtnNumber8 = 3;
//    nBtnNumber9 = 3;
//    nBtnOK = 5;
    //    nBtnQuit = 3;
}

void operationWindow::setSamePart1(int n)
{
    switch (countInputNumber)
    {
    case 1://1是第一个数
    {
        data[0] = n;
        timerStop = 1;
        QStringList list;
        QString str = QString("输入断面号：__%1").arg(data[0]);
        list<<"选择工作断面"
              <<str
              <<"输入剖面号：___"
              <<"确认─执行操作"
              <<"退出─取消操作";
        showTableWidgetStrList(list);
        countInputNumber++;
        saveData = data[0];
        break;
    }
    case 2://1是第二个数
    {
        data[1] = n;//保存在数组中间
        timerStop = 1;
        QStringList list;
        QString str = QString("输入断面号：_%1").arg(data[1]+data[0]*10);
        list<<"选择工作断面"
              <<str
              <<"输入剖面号：___"
              <<"确认─执行操作"
              <<"退出─取消操作";
        showTableWidgetStrList(list);
        countInputNumber++;
        saveData = data[1]+data[0]*10;
        break;
    }
    case 3://1是第三个数
    {
        data[2] = n;//保存在数组最后
        timerStop = 1;
        QStringList list;
        QString str = QString("输入断面号：%1").arg(data[2]+data[1]*10+data[0]*100);
        list<<"选择工作断面"
              <<str
              <<"输入剖面号：___"
              <<"确认─执行操作"
              <<"退出─取消操作";
        showTableWidgetStrList(list);
        countInputNumber++;
        saveData = data[2]+data[1]*10+data[0]*100;
        break;
    }
    }
}

void operationWindow::setSamePart2(int n)
{
    switch (countInputNumber)
    {
    case 1://1是第一个数
    {
        data2[0] = n;
        timerStop2 = 1;
        QStringList list;
        QString str = QString("输入断面号：%1").arg(saveData);
        QString str2 = QString("输入剖面号：__%1").arg(data2[0]);
        list<<"选择工作断面"
              <<str
              <<str2
              <<"确认─执行操作"
              <<"退出─取消操作";
        showTableWidgetStrList(list);
        countInputNumber++;
        break;
    }
    case 2://1是第二个数
    {
        data2[1] = n;//保存在数组中间
        timerStop2 = 1;
        QStringList list;
        QString str = QString("输入断面号：%1").arg(saveData);
        QString str2 = QString("输入剖面号：_%1").arg(data2[1]+data2[0]*10);
        list<<"选择工作断面"
              <<str
              <<str2
              <<"确认─执行操作"
              <<"退出─取消操作";
        showTableWidgetStrList(list);
        countInputNumber++;
        break;
    }
    case 3://1是第三个数
    {
        data2[2] = n;//保存在数组最后
        timerStop2 = 1;
        QStringList list;
        QString str = QString("输入断面号：%1").arg(saveData);
        QString str2 = QString("输入剖面号：%1").arg(data2[2]+data2[1]*10+data2[0]*100);
        list<<"选择工作断面"
              <<str
              <<str2
              <<"确认─执行操作"
              <<"退出─取消操作";
        showTableWidgetStrList(list);
        countInputNumber++;
        break;
    }

    }
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 3;
    nBtnNumber1 = 6;
    nBtnNumber2 = 6;
    nBtnNumber3 = 6;
    nBtnNumber4 = 5;
    nBtnNumber5 = 4;
    nBtnNumber6 = 3;
    nBtnNumber7 = 3;
    nBtnNumber8 = 3;
    nBtnNumber9 = 3;
    nBtnOK = 5;
    nBtnQuit = 3;
}

void operationWindow::measureMethodSamePart1(int n)
{
    switch (countInputNumberMeasure)
    {
    case 1://2是第一个数
    {
        dataMeasure[0] = n;
        timerStopMeasure = 1;
        QStringList list;
        QString str = QString("输入起始剖面号：__%1").arg(dataMeasure[0]);
        list<<str
              <<"输入结束剖面号：___";
        showTableWidgetStrList(list);
        countInputNumberMeasure++;
        saveDataMeasure = dataMeasure[0];
        break;
    }
    case 2://2是第二个数
    {
        dataMeasure[1] = n;//保存在数组中间
        timerStopMeasure = 1;
        QStringList list;
        QString str = QString("输入起始剖面号：_%1").arg(dataMeasure[1]+dataMeasure[0]*10);
        list<<str
              <<"输入结束剖面号：___";
        showTableWidgetStrList(list);
        countInputNumberMeasure++;
        saveDataMeasure = dataMeasure[1]+dataMeasure[0]*10;
        break;
    }
    case 3://2是第三个数
    {
        dataMeasure[2] = n;//保存在数组最后
        timerStopMeasure = 1;
        QStringList list;
        QString str = QString("输入起始剖面号：%1").arg(dataMeasure[2]+dataMeasure[1]*10+dataMeasure[0]*100);
        list<<str
              <<"输入结束剖面号：___";
        showTableWidgetStrList(list);
        countInputNumberMeasure++;
        saveDataMeasure = dataMeasure[2]+dataMeasure[1]*10+dataMeasure[0]*100;
        break;
    }
    }
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 4;
    nBtnNumber1 = 8;
    nBtnNumber2 = 8;
    nBtnNumber3 = 7;
    nBtnNumber4 = 6;
    nBtnNumber5 = 5;
    nBtnNumber6 = 4;
    nBtnNumber7 = 4;
    nBtnNumber8 = 4;
    nBtnNumber9 = 4;
    nBtnOK = 6;
    nBtnQuit = 4;
}

void operationWindow::measureMethodSamePart2(int n)
{
    switch (countInputNumberMeasure)
    {

    case 1://n是第一个数
    {
        dataMeasure2[0] = n;
        timerStopMeasure2 = 1;
        QStringList list;
        QString str = QString("输入起始剖面号：%1").arg(saveDataMeasure);
        QString str2 = QString("输入结束剖面号：__%1").arg(dataMeasure2[0]);
        list<<str
            <<str2;
        showTableWidgetStrList(list);
        saveDataMeasure2 = dataMeasure2[0];
        countInputNumberMeasure++;
        break;
    }
    case 2://n是第二个数
    {
        dataMeasure2[1] = n;//保存在数组中间
        timerStopMeasure2 = 1;
        QStringList list;
        QString str = QString("输入起始剖面号：%1").arg(saveDataMeasure);
        QString str2 = QString("输入结束剖面号：_%1").arg(dataMeasure2[1]+dataMeasure2[0]*10);
        list<<str
             <<str2;
        showTableWidgetStrList(list);
        saveDataMeasure2 = dataMeasure2[1]+dataMeasure2[0]*10;
        countInputNumberMeasure++;
        break;
    }
    case 3://n是第三个数
    {
        dataMeasure2[2] = n;//保存在数组最后
        timerStopMeasure2 = 1;
        QStringList list;
        QString str = QString("输入起始剖面号：%1").arg(saveDataMeasure);
        QString str2 = QString("输入结束剖面号：%1").arg(dataMeasure2[1]*10+dataMeasure2[0]*100+dataMeasure2[2]);
        list<<str
             <<str2;
        showTableWidgetStrList(list);
        saveDataMeasure2 = dataMeasure2[1]*10+dataMeasure2[0]*100+dataMeasure2[2];
        countInputNumberMeasure++;
        break;
    }
    }
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 5;
    nBtnNumber1 = 9;
    nBtnNumber2 = 9;
    nBtnNumber3 = 8;
    nBtnNumber4 = 7;
    nBtnNumber5 = 6;
    nBtnNumber6 = 5;
    nBtnNumber7 = 5;
    nBtnNumber8 = 5;
    nBtnNumber9 = 5;
    nBtnOK = 7;
    nBtnQuit = 5;

    timerStopMeasure = 1;
    timerStopMeasure2 = 1;
}

void operationWindow::measureAfterFirstOk()
{
    QTimer *timer = new QTimer(this);
    timer->start(500);
    QString str;
    if((saveDataMeasure/100) >= 1)//三位数
    {
        str = QString("输入起始剖面号：%1").arg(saveDataMeasure);
    }
    else
    {
        if((saveDataMeasure/10) > 1)//二位数
        {

            str = QString("输入起始剖面号：_%1").arg(saveDataMeasure);
        }
        else  //一位数
        {
            str = QString("输入起始剖面号：__%1").arg(saveDataMeasure);
        }
    }
    connect(timer,&QTimer::timeout,[=](){
        QStringList list;
        if(timerStopMeasure2 == 1)
        {
            timer->stop();

        }
        else
        {
            if(loop == true)
            {
                list.clear();
                list<<str
                      <<QString("输入结束剖面号：%1_").arg(arrayData[2]);
                loop = false;
            }
            else
            {
                list.clear();
                list<<str
                      <<QString("输入结束剖面号：%1 ").arg(arrayData[2]);
                loop = true;
            }
//                    qDebug()<<loop;
            showTableWidgetStrList(list);

        }
    });
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态更新
    nBtnNumber0 = 5;
    nBtnNumber1 = 9;
    nBtnNumber2 = 9;
    nBtnNumber3 = 8;
    nBtnNumber4 = 7;
    nBtnNumber5 = 6;
    nBtnNumber6 = 5;
    nBtnNumber7 = 5;
    nBtnNumber8 = 5;
    nBtnNumber9 = 5;
    nBtnOK = 7;
    nBtnQuit = 5;

    countInputNumberMeasure = 1;
}

//在测量界面-输入三个测量参数
void operationWindow::measureInputData(QString str[], int n)
{
    QTimer *measureTime = new QTimer(this);
    measureTime->start(500);

//        qDebug()<<n;
    connect(measureTime,&QTimer::timeout,[=](){

        if(measureStop == 0)
        {
            QStringList list;
            switch (n)
            {
            case 1://实接电极数:60
            {
//                    qDebug()<<arrayTimer;
                QString str1 = "实接电极数：__";
                QString str2 = "实接电极数：  ";

                if(measureTimer == 1)
                {
                    list<<str[0]
                            <<str1
                           <<str[2]
                          <<str[3]
                         <<str[4]
                        <<str[5];
                    showTableWidgetStrList(list);
                    measureTimer = -measureTimer;
                }
                else
                {
//                        qDebug()<<arrayTimer;
                    if(measureTimer == -1)
                    {
                        list<<str[0]
                                <<str2
                               <<str[2]
                              <<str[3]
                             <<str[4]
                            <<str[5];
//                            qDebug()<<str2;
                        showTableWidgetStrList(list);
                        measureTimer = -measureTimer;
                    }
                }


                break;
            }
            case 2://输入电极号: 1
            {
//                    qDebug()<<"arrayTimer";
                QString str1 = "输入电极号：__";
                QString str2 = "输入电极号：  ";
                if(measureTimer == 1)
                {
                list<<str[0]
                        <<str[1]
                        <<str1
                        <<str[3]
                        <<str[4]
                        <<str[5];
                showTableWidgetStrList(list);
//                    qDebug()<<arrayTimer;
                measureTimer = -measureTimer;
                }
                else
                {
                    if(measureTimer == -1)
                    {
                        list<<str[0]
                                <<str[1]
                                <<str2
                               <<str[3]
                              <<str[4]
                             <<str[5];
                        showTableWidgetStrList(list);
//                            qDebug()<<str2;
                        measureTimer = -measureTimer;
                    }
                }
                break;
            }
            case 3://输入滚动号:■1
            {
                QString str1 = "输入滚动号：1_";
                QString str2 = "输入滚动号：1 ";

                if(measureTimer == 1)
                {
                list<<str[0]
                        <<str[1]
                        <<str[2]
                        <<str1
                        <<str[4]
                        <<str[5];
                showTableWidgetStrList(list);
                measureTimer = -measureTimer;
                }
                else
                {
                    if(measureTimer == -1)
                    {
                        list<<str[0]
                                <<str[1]
                                <<str[2]
                                <<str2
                               <<str[4]
                              <<str[5];
                        showTableWidgetStrList(list);
                        measureTimer = -measureTimer;
                    }
                }
                break;
            }
            }
        }
        else
        {
            measureTime->stop();
        }

    });
}

void operationWindow::measureInputFirstNumber(int n)
{
    switch (countMeasureInput)
    {
    case 1://n是第一个数
    {
        measureSaveData[0] = n;//保存在数组中
        measureStop = 1;
        QStringList list;
        measureInputString[1] = QString("实接电极数：_%1").arg(measureSaveData[0]);
        list<<measureInputString[0]
                <<measureInputString[1]
                <<measureInputString[2]
                <<measureInputString[3]
                <<measureInputString[4]
                <<measureInputString[5];
        showTableWidgetStrList(list);
        countMeasureInput++;
        measureSaveDataAll[0] = measureSaveData[0];
        break;
    }
    case 2://n是第二个数
    {
        measureSaveData[1] = n;//保存在数组中
        measureStop = 1;
        QStringList list;
        measureInputString[1] = QString("实接电极数：%1").arg(measureSaveData[0]*10+measureSaveData[1]);
        list<<measureInputString[0]
                <<measureInputString[1]
                <<measureInputString[2]
                <<measureInputString[3]
                <<measureInputString[4]
                <<measureInputString[5];
        showTableWidgetStrList(list);
        countMeasureInput++;
        measureSaveDataAll[0] = measureSaveData[0]*10+measureSaveData[1];
        break;
    }
    }
    //数字键、确认、退出可用
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 9;
    nBtnNumber1 = 14;
    nBtnNumber2 = 14;
    nBtnNumber3 = 13;
    nBtnNumber4 = 12;
    nBtnNumber5 = 11;
    nBtnNumber6 = 10;
    nBtnNumber7 = 10;
    nBtnNumber8 = 10;
    nBtnNumber9 = 10;
    nBtnOK = 13;
    nBtnQuit = 9;
}

void operationWindow::measureInputSecondNumber(int n)
{
    switch (countMeasureInput)
    {
    case 1://n是第一个数
    {
        measureSaveData[0] = n;//保存在数组中
        measureStop = 1;
        QStringList list;
        measureInputString[2] = QString("输入电极号：_%1").arg(measureSaveData[0]);
        list<<measureInputString[0]
                <<measureInputString[1]
                <<measureInputString[2]
                <<measureInputString[3]
                <<measureInputString[4]
                <<measureInputString[5];
        showTableWidgetStrList(list);
        countMeasureInput++;
        measureSaveDataAll[1] = measureSaveData[0];
        break;
    }
    case 2://n是第二个数
    {
        measureSaveData[1] = n;//保存在数组中
        measureStop = 1;
        QStringList list;
        measureInputString[2] = QString("输入电极号：%1").arg(measureSaveData[0]*10+measureSaveData[1]);
        list<<measureInputString[0]
                <<measureInputString[1]
                <<measureInputString[2]
                <<measureInputString[3]
                <<measureInputString[4]
                <<measureInputString[5];
        showTableWidgetStrList(list);
        countMeasureInput++;
        measureSaveDataAll[1] = measureSaveData[0]*10+measureSaveData[1];
        break;
    }
    }
    //数字键、确认、退出可用
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 10;
    nBtnNumber1 = 15;
    nBtnNumber2 = 15;
    nBtnNumber3 = 14;
    nBtnNumber4 = 13;
    nBtnNumber5 = 12;
    nBtnNumber6 = 11;
    nBtnNumber7 = 11;
    nBtnNumber8 = 11;
    nBtnNumber9 = 11;
    nBtnOK = 14;
    nBtnQuit = 10;
}

void operationWindow::highDensityPowerSupplyTime(int n)
{
//    qDebug()<<highDensityCount;
    switch (highDensityCount)
    {

    case 1://n是第一个数
    {
        highDensityData[0] = n;//保存在数组中
        sleepStop = 1;
        QStringList list;
        QString strTemp = QString("供电时间:_%1").arg(highDensityData[0]);
        showTableWidgetStr(strTemp);
        highDensityCount++;
        highDensityDataAll = highDensityData[0];
        break;
    }
    case 2://n是第二个数
    {
        highDensityData[1] = n;//保存在数组中
        sleepStop = 1;
        QStringList list;
        QString strTemp = QString("供电时间:%1").arg(highDensityData[0]*10+highDensityData[1]);
        showTableWidgetStr(strTemp);
        highDensityCount++;
        highDensityDataAll = highDensityData[0]*10+highDensityData[1];
        break;
    }
    }
    //数字键、确认、退出可用
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 11;
    nBtnNumber1 = 16;
    nBtnNumber2 = 16;
    nBtnNumber3 = 15;
    nBtnNumber4 = 14;
    nBtnNumber5 = 13;
    nBtnNumber6 = 12;
    nBtnNumber7 = 12;
    nBtnNumber8 = 12;
    nBtnNumber9 = 12;
    nBtnOK = 16;
    nBtnQuit = 11;
}

void operationWindow::arrayFlashing(QString str[], int n)
{
        QTimer *timer = new QTimer(this);
        timer->start(500);

//        qDebug()<<n;
        connect(timer,&QTimer::timeout,[=](){

            if(arrayStop == 0)
            {
                QStringList list;
                switch (n)
                {
                case 0:
                {
//                    qDebug()<<n;
                    QString str1 = QString("装置:%1__").arg(arrangement[arrayCount]);
                    QString str2 = QString("装置:%1  ").arg(arrangement[arrayCount]);

//                    qDebug()<<arrayTimer;
                    if(arrayTimer == 1)
                    {
                    list<<str1
                            <<str[1]
                            <<str[2]
                            <<str[3]
                            <<str[4]
                            <<str[5];
                    showTableWidgetStrList(list);

                    arrayTimer = -arrayTimer;
                    }
                    else
                    {
                        list<<str2
                                <<str[1]
                                <<str[2]
                                <<str[3]
                                <<str[4]
                                <<str[5];
                        showTableWidgetStrList(list);

                        arrayTimer = -arrayTimer;
                    }
                    break;
                }
                case 1://滚动总数：1
                {
//                    qDebug()<<arrayTimer;
                    QString str1 = "滚动总数:__";
                    QString str2 = "滚动总数:  ";

                    if(arrayTimer == 1)
                    {
                        list<<str[0]
                                <<str1
                               <<str[2]
                              <<str[3]
                             <<str[4]
                            <<str[5];
                        showTableWidgetStrList(list);
                        arrayTimer = -arrayTimer;
                    }
                    else
                    {
//                        qDebug()<<arrayTimer;
                        if(arrayTimer == -1)
                        {
                            list<<str[0]
                                    <<str2
                                   <<str[2]
                                  <<str[3]
                                 <<str[4]
                                <<str[5];
//                            qDebug()<<str2;
                            showTableWidgetStrList(list);
                            arrayTimer = -arrayTimer;
                        }
                    }


                    break;
                }
                case 2://使用电极数：60
                {
//                    qDebug()<<arrayTimer;
                    QString str1 = "使用电极数：__";
                    QString str2 = "使用电极数：  ";
                    if(arrayTimer == 1)
                    {
                    list<<str[0]
                            <<str[1]
                            <<str1
                            <<str[3]
                            <<str[4]
                            <<str[5];
                    showTableWidgetStrList(list);
//                    qDebug()<<arrayTimer;
                    arrayTimer = -arrayTimer;
                    }
                    else
                    {
                        if(arrayTimer == -1)
                        {
                            list<<str[0]
                                    <<str[1]
                                    <<str2
                                   <<str[3]
                                  <<str[4]
                                 <<str[5];
                            showTableWidgetStrList(list);
//                            qDebug()<<str2;
                            arrayTimer = -arrayTimer;
                        }
                    }
                    break;
                }
                case 3://点距：1.0
                {
                    QString str1 = "点距:_._";
                    QString str2 = "点距: . ";

                    if(arrayTimer == 1)
                    {
                    list<<str[0]
                            <<str[1]
                            <<str[2]
                            <<str1
                            <<str[4]
                            <<str[5];
                    showTableWidgetStrList(list);
                    arrayTimer = -arrayTimer;
                    }
                    else
                    {
                        if(arrayTimer == -1)
                        {
                            list<<str[0]
                                    <<str[1]
                                    <<str[2]
                                    <<str2
                                   <<str[4]
                                  <<str[5];
                            showTableWidgetStrList(list);
                            arrayTimer = -arrayTimer;
                        }
                    }
                    break;
                }
                case 4://剖面数：16
                {
                    QString str1 = "剖面数：__";
                    QString str2 = "剖面数：  ";

                    if(arrayTimer == 1)
                    {
                    list<<str[0]
                            <<str[1]
                            <<str[2]
                            <<str[3]
                            <<str1
                            <<str[5];
                    showTableWidgetStrList(list);
                    arrayTimer = -arrayTimer;
                    }
                    else
                    {
                        if(arrayTimer == -1)
                        {
                        list<<str[0]
                                <<str[1]
                                <<str[2]
                                <<str[3]
                                <<str2
                                <<str[5];
                        showTableWidgetStrList(list);
                        arrayTimer = -arrayTimer;
                        }
                    }
                    break;
                }
                }
            }
            else
            {
                timer->stop();
            }

        });
}

void operationWindow::arrayElectrode(int n)
{
    switch (countArrayInputNumber)
    {
    case 1://n是第一个数
    {
        arrayDataCount[0] = n;//保存在数组中
        arrayStop = 1;
        QStringList list;
        flashingStr[2] = QString("使用电极数：_%1").arg(arrayDataCount[0]);
        list<<flashingStr[0]
                <<flashingStr[1]
                <<flashingStr[2]
                <<flashingStr[3]
                <<flashingStr[4]
                <<flashingStr[5];
        showTableWidgetStrList(list);
        countArrayInputNumber++;
        arrayData[1] = arrayDataCount[0];
        break;
    }
    case 2://n是第二个数
    {
        arrayDataCount[1] = n;//保存在数组中
        arrayStop = 1;
        QStringList list;
        flashingStr[2] = QString("使用电极数：%1").arg(arrayDataCount[1]+arrayDataCount[0]*10);
        list<<flashingStr[0]
                <<flashingStr[1]
                <<flashingStr[2]
                <<flashingStr[3]
                <<flashingStr[4]
                <<flashingStr[5];
        showTableWidgetStrList(list);
        countArrayInputNumber++;
        arrayData[1] = arrayDataCount[1]+arrayDataCount[0]*10;
        break;
    }
    }
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 6;
    nBtnNumber1 = 11;
    nBtnNumber2 = 11;
    nBtnNumber3 = 10;
    nBtnNumber4 = 9;
    nBtnNumber5 = 8;
    nBtnNumber6 = 7;
    nBtnNumber7 = 7;
    nBtnNumber8 = 7;
    nBtnNumber9 = 7;
    nBtnOK = 10;
    nBtnQuit = 6;
}

void operationWindow::arrayDotPitch(int n)
{
//   qDebug()<< countArrayInputNumber;
    switch (countArrayInputNumber)
    {
    case 1://n是第一个数
    {
        arrayDataCount[0] = n;//保存在数组中
        arrayStop = 1;
        QStringList list;
        flashingStr[3] = QString("点距:%1._").arg(arrayDataCount[0]);
        list<<flashingStr[0]
                <<flashingStr[1]
                <<flashingStr[2]
                <<flashingStr[3]
                <<flashingStr[4]
                <<flashingStr[5];
        showTableWidgetStrList(list);
        countArrayInputNumber++;
        dotPitch = arrayDataCount[0];
        break;
    }
    case 2://n是第二个数
    {
        arrayDataCount[1] = n;//保存在数组中
        arrayStop = 1;
        QStringList list;
        flashingStr[3] = QString("点距:%1.%2").arg(arrayDataCount[0]).arg(arrayDataCount[1]);
        list<<flashingStr[0]
                <<flashingStr[1]
                <<flashingStr[2]
                <<flashingStr[3]
                <<flashingStr[4]
                <<flashingStr[5];
        showTableWidgetStrList(list);
        countArrayInputNumber++;
        dotPitch = arrayDataCount[1]*0.1+arrayDataCount[0];
        break;
    }
    }
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 7;
    nBtnNumber1 = 12;
    nBtnNumber2 = 12;
    nBtnNumber3 = 11;
    nBtnNumber4 = 10;
    nBtnNumber5 = 9;
    nBtnNumber6 = 8;
    nBtnNumber7 = 8;
    nBtnNumber8 = 8;
    nBtnNumber9 = 8;
    nBtnOK = 11;
    nBtnQuit = 7;
}

void operationWindow::arraySectionNumber(int n)
{
    switch (countArrayInputNumber)
    {
    case 1://n是第一个数
    {
        arrayDataCount[0] = n;//保存在数组中
        arrayStop = 1;
        QStringList list;
        flashingStr[4] = QString("剖面数：_%1").arg(arrayDataCount[0]);
        list<<flashingStr[0]
                <<flashingStr[1]
                <<flashingStr[2]
                <<flashingStr[3]
                <<flashingStr[4]
                <<flashingStr[5];
        showTableWidgetStrList(list);
        countArrayInputNumber++;
        arrayData[2] = arrayDataCount[0];
        break;
    }
    case 2://n是第二个数
    {
        arrayDataCount[1] = n;//保存在数组中
        arrayStop = 1;
        QStringList list;
        flashingStr[4] = QString("剖面数：%1").arg(arrayDataCount[1]+arrayDataCount[0]*10);
        list<<flashingStr[0]
                <<flashingStr[1]
                <<flashingStr[2]
                <<flashingStr[3]
                <<flashingStr[4]
                <<flashingStr[5];
        showTableWidgetStrList(list);
        countArrayInputNumber++;
        arrayData[2] = arrayDataCount[1]+arrayDataCount[0]*10;
        break;
    }
    }
    //数字键、确认、退出可用了
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 8;
    nBtnNumber1 = 13;
    nBtnNumber2 = 13;
    nBtnNumber3 = 12;
    nBtnNumber4 = 11;
    nBtnNumber5 = 10;
    nBtnNumber6 = 9;
    nBtnNumber7 = 9;
    nBtnNumber8 = 9;
    nBtnNumber9 = 9;
    nBtnOK = 12;
    nBtnQuit = 8;
}

void operationWindow::profileCurveInputData(int n)
{
    switch (profileCurveCount)
    {
    case 1://n是第一个数
    {
        profileCurveData[0] = n;//保存在数组中
        profileCurveStop = 1;
        QStringList list;
        QString strTemp = QString("输入断面号：_%1").arg(profileCurveData[0]);
        list<<"显示剖面曲线"
        <<strTemp
        <<"输入剖面号：___"
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        profileCurveCount++;
        profileCurveDataAll[0] = profileCurveData[0];
        break;
    }
    case 2://n是第二个数
    {
        profileCurveData[1] = n;//保存在数组中
        profileCurveStop = 1;
        QStringList list;
        QString strTemp = QString("输入断面号：_%1").arg(profileCurveData[0]*10+profileCurveData[1]);
        list<<"显示剖面曲线"
        <<strTemp
        <<"输入剖面号：___"
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        profileCurveCount++;
        profileCurveDataAll[0] = profileCurveData[0]*10+profileCurveData[1];
        break;
    }
    case 3://n是第三个数
    {
        profileCurveData[2] = n;//保存在数组中
        profileCurveStop = 1;
        QStringList list;
        QString strTemp = QString("输入断面号：%1").arg(profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2]);
        list<<"显示剖面曲线"
        <<strTemp
        <<"输入剖面号：___"
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        profileCurveCount++;
        profileCurveDataAll[0] = profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2];
        break;
    }
    }
    //数字键、确认、退出可用
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 12;
    nBtnNumber1 = 17;
    nBtnNumber2 = 17;
    nBtnNumber3 = 16;
    nBtnNumber4 = 15;
    nBtnNumber5 = 15;
    nBtnNumber6 = 13;
    nBtnNumber7 = 13;
    nBtnNumber8 = 13;
    nBtnNumber9 = 13;
    nBtnOK = 17;
    nBtnQuit = 12;
}

void operationWindow::profileCurveInputSecondData(int n)
{
    switch (profileCurveCount)
    {
    case 1://n是第一个数
    {
        profileCurveData[0] = n;//保存在数组中
        profileCurveStop = 1;
        QStringList list;
        QString strTemp1 = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
        QString strTemp2 = QString("输入剖面号：_%1").arg(profileCurveData[0]);
        list<<"显示剖面曲线"
        <<strTemp1
        <<strTemp2
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        profileCurveCount++;
        profileCurveDataAll[1] = profileCurveData[0];
        break;
    }
    case 2://n是第二个数
    {
        profileCurveData[1] = n;//保存在数组中
        profileCurveStop = 1;
        QStringList list;
        QString strTemp1 = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
        QString strTemp2 = QString("输入剖面号：_%1").arg(profileCurveData[0]*10+profileCurveData[1]);
        list<<"显示剖面曲线"
        <<strTemp1
        <<strTemp2
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        profileCurveCount++;
        profileCurveDataAll[1] = profileCurveData[0]*10+profileCurveData[1];
        break;
    }
    case 3://n是第三个数
    {
        profileCurveData[2] = n;//保存在数组中
        profileCurveStop = 1;
        QStringList list;
        QString strTemp1 = QString("输入断面号：%1").arg(profileCurveDataAll[0]);
        QString strTemp2 = QString("输入剖面号：%1").arg(profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2]);
        list<<"显示剖面曲线"
        <<strTemp1
        <<strTemp2
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        profileCurveCount++;
        profileCurveDataAll[1] = profileCurveData[0]*100+profileCurveData[1]*10+profileCurveData[2];
        break;
    }
    }
    //数字键、确认、退出可用
    state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
    state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
    state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
    state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
    state[16] = 0;state[17] = 1;

    //对应按键状态
    nBtnNumber0 = 13;
    nBtnNumber1 = 18;
    nBtnNumber2 = 18;
    nBtnNumber3 = 17;
    nBtnNumber4 = 16;
    nBtnNumber5 = 16;
    nBtnNumber6 = 14;
    nBtnNumber7 = 14;
    nBtnNumber8 = 14;
    nBtnNumber9 = 14;
    nBtnOK = 18;
    nBtnQuit = 13;
}

void operationWindow::sectionCurveInputData(int n)
{
    switch (sectionCurveCount)
    {
    case 1://n是第一个数
    {
        sectionCurveData[0] = n;//保存在数组中
        sectionCurveStop = 1;
        QStringList list;
        QString strTemp = QString("输入断面号：_%1").arg(sectionCurveData[0]);
        list<<"显示断面曲线"
        <<strTemp
        <<"输入剖面号：___"
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        sectionCurveCount++;
        sectionCurveDataAll[0] = sectionCurveData[0];
        break;
    }
    case 2://n是第二个数
    {
        sectionCurveData[1] = n;//保存在数组中
        sectionCurveStop = 1;
        QStringList list;
        QString strTemp = QString("输入断面号：_%1").arg(sectionCurveData[0]*10+sectionCurveData[1]);
        list<<"显示断面曲线"
        <<strTemp
        <<"输入剖面号：___"
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        sectionCurveCount++;
        sectionCurveDataAll[0] = sectionCurveData[0]*10+sectionCurveData[1];
        break;
    }
    case 3://n是第三个数
    {
        sectionCurveData[2] = n;//保存在数组中
        sectionCurveStop = 1;
        QStringList list;
        QString strTemp = QString("输入断面号：%1").arg(sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2]);
        list<<"显示断面曲线"
        <<strTemp
        <<"输入剖面号：___"
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        sectionCurveCount++;
        sectionCurveDataAll[0] = sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2];
        break;
    }
        //数字键、确认、退出可用
        state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
        state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
        state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
        state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
        state[16] = 0;state[17] = 1;

        //对应按键状态
        nBtnNumber0 = 14;
        nBtnNumber1 = 19;
        nBtnNumber2 = 19;
        nBtnNumber3 = 18;
        nBtnNumber4 = 18;
        nBtnNumber5 = 18;
        nBtnNumber6 = 17;
        nBtnNumber7 = 15;
        nBtnNumber8 = 16;
        nBtnNumber9 = 15;
        nBtnOK = 20;
        nBtnQuit = 15;
    }
}

void operationWindow::sectionCurveInputSecondData(int n)
{
    switch (sectionCurveCount)
    {
    case 1://n是第一个数
    {
        sectionCurveData[0] = n;//保存在数组中
        sectionCurveStop = 1;
        QStringList list;
        QString strTemp1 = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
        QString strTemp2 = QString("输入剖面号：_%1").arg(sectionCurveData[0]);
        list<<"显示断面曲线"
        <<strTemp1
        <<strTemp2
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        sectionCurveCount++;
        sectionCurveDataAll[1] = sectionCurveData[0];
        break;
    }
    case 2://n是第二个数
    {
        sectionCurveData[1] = n;//保存在数组中
        sectionCurveStop = 1;
        QStringList list;
        QString strTemp1 = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
        QString strTemp2 = QString("输入剖面号：_%1").arg(sectionCurveData[0]*10+sectionCurveData[1]);
        list<<"显示断面曲线"
        <<strTemp1
        <<strTemp2
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        sectionCurveCount++;
        sectionCurveDataAll[1] = sectionCurveData[0]*10+sectionCurveData[1];
        break;
    }
    case 3://n是第三个数
    {
        sectionCurveData[2] = n;//保存在数组中
        sectionCurveStop = 1;
        QStringList list;
        QString strTemp1 = QString("输入断面号：%1").arg(sectionCurveDataAll[0]);
        QString strTemp2 = QString("输入剖面号：%1").arg(sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2]);
        list<<"显示断面曲线"
        <<strTemp1
        <<strTemp2
        <<"确认─执行操作"
        <<"退出─取消操作";
        showTableWidgetStrList(list);
        sectionCurveCount++;
        sectionCurveDataAll[1] = sectionCurveData[0]*100+sectionCurveData[1]*10+sectionCurveData[2];
        break;
    }
        //数字键、确认、退出可用
        state[0] = 0;state[1] = 1;state[2] = 1;state[3] = 1;
        state[4] = 1;state[5] = 0;state[6] = 1;state[7] = 1;
        state[8] = 1;state[9] = 0;state[10] = 1;state[11] = 1;
        state[12] = 1;state[13] = 1;state[14] = 1;state[15] = 0;
        state[16] = 0;state[17] = 1;

        //对应按键状态
        nBtnNumber0 = 15;
        nBtnNumber1 = 20;
        nBtnNumber2 = 20;
        nBtnNumber3 = 19;
        nBtnNumber4 = 19;
        nBtnNumber5 = 19;
        nBtnNumber6 = 18;
        nBtnNumber7 = 16;
        nBtnNumber8 = 17;
        nBtnNumber9 = 16;
        nBtnOK = 21;
        nBtnQuit = 16;
    }
}



void operationWindow::sleepQt(unsigned int msec)//自定义延时函数
{
    QTime dieTime = QTime::currentTime().addMSecs(msec);
    while( QTime::currentTime() < dieTime )
        QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
}
